/**
 *
 */
import Util;
import OSS;
import OpenPlatform;
import OSSUtil;
import FileForm;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('dianjin', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateAnnualDocSummaryTaskRequest {
  anaYears?: [ int32 ](name='anaYears', description='This parameter is required.'),
  docInfos?: [ 
    {
      docId?: string(name='docId', description='This parameter is required.', example='198386463432'),
      docYear?: int32(name='docYear', description='This parameter is required.', example='2023'),
      endPage?: int32(name='endPage', example='2'),
      libraryId?: string(name='libraryId', description='This parameter is required.', example='rdxrmo6amk'),
      startPage?: int32(name='startPage', example='1'),
    }
  ](name='docInfos', description='This parameter is required.'),
  enableTable?: boolean(name='enableTable', example='true'),
  instruction?: string(name='instruction'),
  modelId?: string(name='modelId', description='This parameter is required.', example='qwen-plus'),
}

model CreateAnnualDocSummaryTaskResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: string(name='data', example='3284627354'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='32FFC91D-0A9F-585A-B84F-8A54C5187035'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-01-01 00:00:00'),
}

model CreateAnnualDocSummaryTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAnnualDocSummaryTaskResponseBody(name='body'),
}

/**
 * @summary 创建按年文档总结任务
 *
 * @param request CreateAnnualDocSummaryTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAnnualDocSummaryTaskResponse
 */
async function createAnnualDocSummaryTaskWithOptions(workspaceId: string, request: CreateAnnualDocSummaryTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateAnnualDocSummaryTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.anaYears)) {
    body['anaYears'] = request.anaYears;
  }
  if (!Util.isUnset(request.docInfos)) {
    body['docInfos'] = request.docInfos;
  }
  if (!Util.isUnset(request.enableTable)) {
    body['enableTable'] = request.enableTable;
  }
  if (!Util.isUnset(request.instruction)) {
    body['instruction'] = request.instruction;
  }
  if (!Util.isUnset(request.modelId)) {
    body['modelId'] = request.modelId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateAnnualDocSummaryTask',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/task/summary/doc/annual`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建按年文档总结任务
 *
 * @param request CreateAnnualDocSummaryTaskRequest
 * @return CreateAnnualDocSummaryTaskResponse
 */
async function createAnnualDocSummaryTask(workspaceId: string, request: CreateAnnualDocSummaryTaskRequest): CreateAnnualDocSummaryTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createAnnualDocSummaryTaskWithOptions(workspaceId, request, headers, runtime);
}

model CreateDialogRequest {
  channel?: string(name='channel', description='This parameter is required.', example='taobao'),
  enableLibrary?: boolean(name='enableLibrary'),
  metaData?: map[string]any(name='metaData', example='null'),
  playCode?: string(name='playCode', description='This parameter is required.', example='live_broadcast_qa'),
  qaLibraryList?: [ string ](name='qaLibraryList'),
  requestId?: string(name='requestId', description='This parameter is required.', example='ebf83826-dc1c-46f8-9759-0fb6da4c8xxx'),
  selfDirected?: boolean(name='selfDirected'),
}

model CreateDialogResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    openingRemarks?: string(name='openingRemarks'),
    sessionId?: string(name='sessionId', example='1728545917713234'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='003D019A-1BB3-53EC-A0D2-CE76DA5D73B1'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-01-01 00:00:00'),
}

model CreateDialogResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDialogResponseBody(name='body'),
}

/**
 * @summary 创建外呼会话
 *
 * @param request CreateDialogRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDialogResponse
 */
async function createDialogWithOptions(workspaceId: string, request: CreateDialogRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateDialogResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.channel)) {
    body['channel'] = request.channel;
  }
  if (!Util.isUnset(request.enableLibrary)) {
    body['enableLibrary'] = request.enableLibrary;
  }
  if (!Util.isUnset(request.metaData)) {
    body['metaData'] = request.metaData;
  }
  if (!Util.isUnset(request.playCode)) {
    body['playCode'] = request.playCode;
  }
  if (!Util.isUnset(request.qaLibraryList)) {
    body['qaLibraryList'] = request.qaLibraryList;
  }
  if (!Util.isUnset(request.requestId)) {
    body['requestId'] = request.requestId;
  }
  if (!Util.isUnset(request.selfDirected)) {
    body['selfDirected'] = request.selfDirected;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateDialog',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/virtualHuman/dialog/create`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建外呼会话
 *
 * @param request CreateDialogRequest
 * @return CreateDialogResponse
 */
async function createDialog(workspaceId: string, request: CreateDialogRequest): CreateDialogResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createDialogWithOptions(workspaceId, request, headers, runtime);
}

model CreateDialogAnalysisTaskRequest {
  analysisNodes?: [ string ](name='analysisNodes'),
  conversationList?: [ 
    {
      dialogueList?: [ 
        {
          content?: string(name='content', description='This parameter is required.'),
          role?: string(name='role', description='This parameter is required.', example='1'),
        }
      ](name='dialogueList', description='This parameter is required.'),
    }
  ](name='conversationList', description='This parameter is required.'),
  metaData?: map[string]any(name='metaData', example='{
"labels": "XXX",
"summaryConstraints": "XXX",
"sopInfo": "XXX"
}'),
  playCode?: string(name='playCode', description='This parameter is required.', example='common'),
  requestId?: string(name='requestId', description='This parameter is required.', example='0FC6636E-380A-5369-AE01-D1C15BB9B254'),
}

model CreateDialogAnalysisTaskResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: [ string ](name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='EF4B5C9B-3BC8-5171-A47B-4C5CF3DC3258'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model CreateDialogAnalysisTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDialogAnalysisTaskResponseBody(name='body'),
}

/**
 * @summary 创建会话分析任务
 *
 * @param request CreateDialogAnalysisTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDialogAnalysisTaskResponse
 */
async function createDialogAnalysisTaskWithOptions(workspaceId: string, request: CreateDialogAnalysisTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateDialogAnalysisTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.analysisNodes)) {
    body['analysisNodes'] = request.analysisNodes;
  }
  if (!Util.isUnset(request.conversationList)) {
    body['conversationList'] = request.conversationList;
  }
  if (!Util.isUnset(request.metaData)) {
    body['metaData'] = request.metaData;
  }
  if (!Util.isUnset(request.playCode)) {
    body['playCode'] = request.playCode;
  }
  if (!Util.isUnset(request.requestId)) {
    body['requestId'] = request.requestId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateDialogAnalysisTask',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/virtualHuman/dialog/analysis/submit`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建会话分析任务
 *
 * @param request CreateDialogAnalysisTaskRequest
 * @return CreateDialogAnalysisTaskResponse
 */
async function createDialogAnalysisTask(workspaceId: string, request: CreateDialogAnalysisTaskRequest): CreateDialogAnalysisTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createDialogAnalysisTaskWithOptions(workspaceId, request, headers, runtime);
}

model CreateDocsSummaryTaskRequest {
  docInfos?: [ 
    {
      docId?: string(name='docId', description='This parameter is required.', example='198386463432'),
      endPage?: int32(name='endPage', example='2'),
      libraryId?: string(name='libraryId', description='This parameter is required.', example='rdxrmo6amk'),
      startPage?: int32(name='startPage', example='1'),
    }
  ](name='docInfos', description='This parameter is required.'),
  enableTable?: boolean(name='enableTable', example='true'),
  instruction?: string(name='instruction'),
  modelId?: string(name='modelId', description='This parameter is required.', example='qwen-plus'),
}

model CreateDocsSummaryTaskResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: string(name='data', example='765675376'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='32FFC91D-0A9F-585A-B84F-8A54C5187035'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-01-01 00:00:00'),
}

model CreateDocsSummaryTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDocsSummaryTaskResponseBody(name='body'),
}

/**
 * @summary 创建财报总结任务
 *
 * @param request CreateDocsSummaryTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDocsSummaryTaskResponse
 */
async function createDocsSummaryTaskWithOptions(workspaceId: string, request: CreateDocsSummaryTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateDocsSummaryTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.docInfos)) {
    body['docInfos'] = request.docInfos;
  }
  if (!Util.isUnset(request.enableTable)) {
    body['enableTable'] = request.enableTable;
  }
  if (!Util.isUnset(request.instruction)) {
    body['instruction'] = request.instruction;
  }
  if (!Util.isUnset(request.modelId)) {
    body['modelId'] = request.modelId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateDocsSummaryTask',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/task/summary/docs`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建财报总结任务
 *
 * @param request CreateDocsSummaryTaskRequest
 * @return CreateDocsSummaryTaskResponse
 */
async function createDocsSummaryTask(workspaceId: string, request: CreateDocsSummaryTaskRequest): CreateDocsSummaryTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createDocsSummaryTaskWithOptions(workspaceId, request, headers, runtime);
}

model CreateFinReportSummaryTaskRequest {
  docId?: string(name='docId', description='This parameter is required.', example='123'),
  enableTable?: boolean(name='enableTable', description='This parameter is required.', example='true'),
  endPage?: int32(name='endPage', example='10'),
  instruction?: string(name='instruction'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='3akzl28vap'),
  modelId?: string(name='modelId', description='This parameter is required.', example='qwen-max'),
  startPage?: int32(name='startPage', example='1'),
  taskType?: string(name='taskType', example='custom'),
}

model CreateFinReportSummaryTaskResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: string(name='data', example='3284627354'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='5E3FBAF1-17AF-53B7-AF0A-CDCEEB6DE658'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model CreateFinReportSummaryTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateFinReportSummaryTaskResponseBody(name='body'),
}

/**
 * @summary 创建财报总结任务
 *
 * @param request CreateFinReportSummaryTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateFinReportSummaryTaskResponse
 */
async function createFinReportSummaryTaskWithOptions(workspaceId: string, request: CreateFinReportSummaryTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateFinReportSummaryTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.docId)) {
    body['docId'] = request.docId;
  }
  if (!Util.isUnset(request.enableTable)) {
    body['enableTable'] = request.enableTable;
  }
  if (!Util.isUnset(request.endPage)) {
    body['endPage'] = request.endPage;
  }
  if (!Util.isUnset(request.instruction)) {
    body['instruction'] = request.instruction;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }
  if (!Util.isUnset(request.modelId)) {
    body['modelId'] = request.modelId;
  }
  if (!Util.isUnset(request.startPage)) {
    body['startPage'] = request.startPage;
  }
  if (!Util.isUnset(request.taskType)) {
    body['taskType'] = request.taskType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateFinReportSummaryTask',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/task/summary`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建财报总结任务
 *
 * @param request CreateFinReportSummaryTaskRequest
 * @return CreateFinReportSummaryTaskResponse
 */
async function createFinReportSummaryTask(workspaceId: string, request: CreateFinReportSummaryTaskRequest): CreateFinReportSummaryTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createFinReportSummaryTaskWithOptions(workspaceId, request, headers, runtime);
}

model CreateLibraryRequest {
  description?: string(name='description', description='This parameter is required.'),
  indexSetting?: {
    chunkStrategy?: {
      docTreeSplit?: boolean(name='docTreeSplit', example='true'),
      docTreeSplitSize?: int32(name='docTreeSplitSize', example='300'),
      enhanceGraph?: boolean(name='enhanceGraph', example='true'),
      enhanceTable?: boolean(name='enhanceTable', example='true'),
      overlap?: int32(name='overlap', example='20'),
      sentenceSplit?: boolean(name='sentenceSplit', example='true'),
      sentenceSplitSize?: int32(name='sentenceSplitSize', example='300'),
      size?: int32(name='size', example='300'),
      split?: boolean(name='split', example='true'),
    }(name='chunkStrategy'),
    modelConfig?: {
      temperature?: double(name='temperature', example='0.8'),
      topP?: double(name='topP', example='0.8'),
    }(name='modelConfig'),
    promptRoleStyle?: string(name='promptRoleStyle'),
    queryEnhancer?: {
      enableFollowUp?: boolean(name='enableFollowUp', example='true'),
      enableMultiQuery?: boolean(name='enableMultiQuery', example='true'),
      enableOpenQa?: boolean(name='enableOpenQa', example='true'),
      enableQueryRewrite?: boolean(name='enableQueryRewrite', example='true'),
      enableSession?: boolean(name='enableSession', example='true'),
      localKnowledgeId?: string(name='localKnowledgeId', example='xxxx'),
      withDocumentReference?: boolean(name='withDocumentReference', example='true'),
    }(name='queryEnhancer'),
    recallStrategy?: {
      documentRankType?: string(name='documentRankType', example='model'),
      limit?: int32(name='limit', example='20'),
    }(name='recallStrategy'),
    textIndexSetting?: {
      category?: string(name='category', example='ElasticSearch'),
      enable?: boolean(name='enable', example='true'),
      indexAnalyzer?: string(name='indexAnalyzer', example='Standard'),
      rankThreshold?: double(name='rankThreshold', example='0.5'),
      searchAnalyzer?: string(name='searchAnalyzer', example='Standard'),
      topK?: int32(name='topK', example='50'),
    }(name='textIndexSetting'),
    vectorIndexSetting?: {
      category?: string(name='category', example='ADB'),
      embeddingType?: string(name='embeddingType', example='DashScope'),
      enable?: boolean(name='enable', example='true'),
      rankThreshold?: double(name='rankThreshold', example='0.5'),
      topK?: int32(name='topK', example='50'),
    }(name='vectorIndexSetting'),
  }(name='indexSetting'),
  libraryName?: string(name='libraryName', description='This parameter is required.'),
}

model CreateLibraryResponseBody = {
  cost?: long(name='cost', example='300'),
  data?: string(name='data', example='a1b2c3'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message'),
  requestId?: string(name='requestId', example='xxxx-xxxx-xxxx-xxxx'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='null'),
}

model CreateLibraryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateLibraryResponseBody(name='body'),
}

/**
 * @summary 创建文档库
 *
 * @param request CreateLibraryRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateLibraryResponse
 */
async function createLibraryWithOptions(workspaceId: string, request: CreateLibraryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateLibraryResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.indexSetting)) {
    body['indexSetting'] = request.indexSetting;
  }
  if (!Util.isUnset(request.libraryName)) {
    body['libraryName'] = request.libraryName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateLibrary',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/create`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建文档库
 *
 * @param request CreateLibraryRequest
 * @return CreateLibraryResponse
 */
async function createLibrary(workspaceId: string, request: CreateLibraryRequest): CreateLibraryResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createLibraryWithOptions(workspaceId, request, headers, runtime);
}

model CreatePdfTranslateTaskRequest {
  docId?: string(name='docId', description='This parameter is required.', example='873648346573245'),
  knowledge?: string(name='knowledge'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='cjshcxxxx'),
  modelId?: string(name='modelId', description='This parameter is required.', example='qwen-plus'),
  translateTo?: string(name='translateTo', example='中文'),
}

model CreatePdfTranslateTaskResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: string(name='data', example='3284627354'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='5E3FBAF1-17AF-53B7-AF0A-CDCEEB6DE658'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model CreatePdfTranslateTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreatePdfTranslateTaskResponseBody(name='body'),
}

/**
 * @summary 创建PDF翻译任务
 *
 * @param request CreatePdfTranslateTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePdfTranslateTaskResponse
 */
async function createPdfTranslateTaskWithOptions(workspaceId: string, request: CreatePdfTranslateTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreatePdfTranslateTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.docId)) {
    body['docId'] = request.docId;
  }
  if (!Util.isUnset(request.knowledge)) {
    body['knowledge'] = request.knowledge;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }
  if (!Util.isUnset(request.modelId)) {
    body['modelId'] = request.modelId;
  }
  if (!Util.isUnset(request.translateTo)) {
    body['translateTo'] = request.translateTo;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreatePdfTranslateTask',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/task/pdfTranslate`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建PDF翻译任务
 *
 * @param request CreatePdfTranslateTaskRequest
 * @return CreatePdfTranslateTaskResponse
 */
async function createPdfTranslateTask(workspaceId: string, request: CreatePdfTranslateTaskRequest): CreatePdfTranslateTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createPdfTranslateTaskWithOptions(workspaceId, request, headers, runtime);
}

model CreatePredefinedDocumentRequest {
  chunks?: [ 
    {
      chunkMeta?: map[string]any(name='chunkMeta', example='{"a": "1"}'),
      chunkOrder?: int32(name='chunkOrder', example='1'),
      chunkText?: string(name='chunkText', example='这是一段测试文本'),
      chunkType?: string(name='chunkType', example='text'),
    }
  ](name='chunks'),
  libraryId?: string(name='libraryId', example='a1b2c3'),
  metadata?: map[string]any(name='metadata', example='{"a": "1"}'),
  title?: string(name='title', example='测试文档'),
}

model CreatePredefinedDocumentResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: string(name='data', example='1782981430906818562'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='0a06dfe617018288881568684e2937'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model CreatePredefinedDocumentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreatePredefinedDocumentResponseBody(name='body'),
}

/**
 * @summary 创建预定义文档
 *
 * @param request CreatePredefinedDocumentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePredefinedDocumentResponse
 */
async function createPredefinedDocumentWithOptions(workspaceId: string, request: CreatePredefinedDocumentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreatePredefinedDocumentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.chunks)) {
    body['chunks'] = request.chunks;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }
  if (!Util.isUnset(request.metadata)) {
    body['metadata'] = request.metadata;
  }
  if (!Util.isUnset(request.title)) {
    body['title'] = request.title;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreatePredefinedDocument',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/document/createPredefinedDocument`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建预定义文档
 *
 * @param request CreatePredefinedDocumentRequest
 * @return CreatePredefinedDocumentResponse
 */
async function createPredefinedDocument(workspaceId: string, request: CreatePredefinedDocumentRequest): CreatePredefinedDocumentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createPredefinedDocumentWithOptions(workspaceId, request, headers, runtime);
}

model CreateQualityCheckTaskRequest {
  conversationList?: {
    callType?: string(name='callType', example='1'),
    customerId?: string(name='customerId', example='1'),
    customerName?: string(name='customerName'),
    customerServiceId?: string(name='customerServiceId', example='xxx'),
    customerServiceName?: string(name='customerServiceName'),
    dialogueList?: [ 
      {
        begin?: int32(name='begin', example='0'),
        beginTime?: string(name='beginTime', example='2024-05-23 14:57:50'),
        content?: string(name='content', description='This parameter is required.'),
        customerId?: string(name='customerId', example='2348234'),
        customerServiceId?: string(name='customerServiceId', example='23874627346'),
        customerServiceType?: string(name='customerServiceType', example='0'),
        end?: int32(name='end', example='0'),
        role?: string(name='role', description='This parameter is required.', example='1'),
        type?: string(name='type', description='This parameter is required.', example='TEXT'),
      }
    ](name='dialogueList', description='This parameter is required.'),
    gmtService?: string(name='gmtService', example='2024-09-27 11:23:20'),
  }(name='conversationList', description='This parameter is required.'),
  gmtService?: string(name='gmtService', description='This parameter is required.', example='2024-09-27 11:23:20'),
  metaData?: map[string]string(name='metaData'),
  qualityGroup?: [ string ](name='qualityGroup'),
  requestId?: string(name='requestId', description='This parameter is required.', example='0FC6636E-380A-5369-AE01-D1C15BB9B254'),
  type?: string(name='type', description='This parameter is required.', example='0'),
}

model CreateQualityCheckTaskResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    taskId?: string(name='taskId', description='taskId', example='172373500521'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='EF4B5C9B-3BC8-5171-A47B-4C5CF3DC3258'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model CreateQualityCheckTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateQualityCheckTaskResponseBody(name='body'),
}

/**
 * @summary 创建财报总结的任务
 *
 * @param request CreateQualityCheckTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateQualityCheckTaskResponse
 */
async function createQualityCheckTaskWithOptions(workspaceId: string, request: CreateQualityCheckTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateQualityCheckTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.conversationList)) {
    body['conversationList'] = request.conversationList;
  }
  if (!Util.isUnset(request.gmtService)) {
    body['gmtService'] = request.gmtService;
  }
  if (!Util.isUnset(request.metaData)) {
    body['metaData'] = request.metaData;
  }
  if (!Util.isUnset(request.qualityGroup)) {
    body['qualityGroup'] = request.qualityGroup;
  }
  if (!Util.isUnset(request.requestId)) {
    body['requestId'] = request.requestId;
  }
  if (!Util.isUnset(request.type)) {
    body['type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateQualityCheckTask',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/qualitycheck/task/submit`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建财报总结的任务
 *
 * @param request CreateQualityCheckTaskRequest
 * @return CreateQualityCheckTaskResponse
 */
async function createQualityCheckTask(workspaceId: string, request: CreateQualityCheckTaskRequest): CreateQualityCheckTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createQualityCheckTaskWithOptions(workspaceId, request, headers, runtime);
}

model DeleteDocumentRequest {
  docIds?: [ string ](name='docIds', description='This parameter is required.'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='3akzl28vap'),
}

model DeleteDocumentResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: boolean(name='data', example='True'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='67C7021A-D268-553D-8C15-A087B9604028'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model DeleteDocumentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDocumentResponseBody(name='body'),
}

/**
 * @summary 删除文档
 *
 * @param request DeleteDocumentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDocumentResponse
 */
async function deleteDocumentWithOptions(workspaceId: string, request: DeleteDocumentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteDocumentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.docIds)) {
    body['docIds'] = request.docIds;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDocument',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/document/delete`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 删除文档
 *
 * @param request DeleteDocumentRequest
 * @return DeleteDocumentResponse
 */
async function deleteDocument(workspaceId: string, request: DeleteDocumentRequest): DeleteDocumentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteDocumentWithOptions(workspaceId, request, headers, runtime);
}

model DeleteLibraryRequest {
  libraryId?: string(name='libraryId', description='This parameter is required.', example='skdfefxxx'),
}

model DeleteLibraryResponseBody = {
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='30F6AD44-F078-540D-B5A5-1E519C8E9E6D'),
  success?: boolean(name='success', example='true'),
}

model DeleteLibraryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteLibraryResponseBody(name='body'),
}

/**
 * @summary 删除文档库
 *
 * @param request DeleteLibraryRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteLibraryResponse
 */
async function deleteLibraryWithOptions(workspaceId: string, request: DeleteLibraryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteLibraryResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.libraryId)) {
    query['libraryId'] = request.libraryId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteLibrary',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/delete`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 删除文档库
 *
 * @param request DeleteLibraryRequest
 * @return DeleteLibraryResponse
 */
async function deleteLibrary(workspaceId: string, request: DeleteLibraryRequest): DeleteLibraryResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteLibraryWithOptions(workspaceId, request, headers, runtime);
}

model EvictTaskRequest {
  taskId?: string(name='taskId', description='This parameter is required.', example='17071319'),
}

model EvictTaskResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: string(name='data', example='17071319'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message'),
  requestId?: string(name='requestId', example='44BD277A-87F9-5310-8D63-3E6645F1DA85'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model EvictTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EvictTaskResponseBody(name='body'),
}

/**
 * @summary 中断任务
 *
 * @param request EvictTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return EvictTaskResponse
 */
async function evictTaskWithOptions(workspaceId: string, request: EvictTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): EvictTaskResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.taskId)) {
    query['taskId'] = request.taskId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'EvictTask',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/task/evict`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 中断任务
 *
 * @param request EvictTaskRequest
 * @return EvictTaskResponse
 */
async function evictTask(workspaceId: string, request: EvictTaskRequest): EvictTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return evictTaskWithOptions(workspaceId, request, headers, runtime);
}

model GenDocQaResultRequest {
  docId?: string(name='docId', description='This parameter is required.', example='182364872346'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='sjdgdsfg'),
  requestId?: string(name='requestId', description='This parameter is required.', example='0FC6636E-380A-5369-AE01-D1C15BB9B254'),
}

model GenDocQaResultResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    currentStatus?: string(name='currentStatus', example='PROCESSING'),
    docId?: string(name='docId', example='873648346573245'),
    libraryId?: string(name='libraryId', example='7wxwrjpabj'),
    parseQaResults?: [ 
      {
        answer?: string(name='answer'),
        question?: string(name='question'),
      }
    ](name='parseQaResults'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='44BD277A-87F9-5310-8D63-3E6645F1DA85'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model GenDocQaResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GenDocQaResultResponseBody(name='body'),
}

/**
 * @summary 根据文档解析问答QA
 *
 * @param request GenDocQaResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GenDocQaResultResponse
 */
async function genDocQaResultWithOptions(workspaceId: string, request: GenDocQaResultRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GenDocQaResultResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.docId)) {
    body['docId'] = request.docId;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }
  if (!Util.isUnset(request.requestId)) {
    body['requestId'] = request.requestId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GenDocQaResult',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/virtualHuman/qa/parse`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 根据文档解析问答QA
 *
 * @param request GenDocQaResultRequest
 * @return GenDocQaResultResponse
 */
async function genDocQaResult(workspaceId: string, request: GenDocQaResultRequest): GenDocQaResultResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return genDocQaResultWithOptions(workspaceId, request, headers, runtime);
}

model GetAppConfigResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    embeddingTypeList?: [ map[string]string ](name='embeddingTypeList'),
    frontendConfig?: map[string]boolean(name='frontendConfig'),
    libraryDocumentStatusList?: [ map[string]string ](name='libraryDocumentStatusList'),
    llmHelperTypeList?: [ map[string]string ](name='llmHelperTypeList'),
    textIndexCategoryList?: [ string ](name='textIndexCategoryList'),
    vectorIndexCategoryList?: [ string ](name='vectorIndexCategoryList'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='None'),
  requestId?: string(name='requestId', example='EF4B5C9B-3BC8-5171-A47B-4C5CF3DC3258'),
  success?: boolean(name='success', example='True'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model GetAppConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAppConfigResponseBody(name='body'),
}

/**
 * @summary 获取app配置
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAppConfigResponse
 */
async function getAppConfigWithOptions(workspaceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetAppConfigResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetAppConfig',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/app/config`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取app配置
 *
 * @return GetAppConfigResponse
 */
async function getAppConfig(workspaceId: string): GetAppConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getAppConfigWithOptions(workspaceId, headers, runtime);
}

model GetChatQuestionRespRequest {
  batchId?: string(name='batchId', description='This parameter is required.', example='1869307330227937280'),
  sessionId?: string(name='sessionId', description='This parameter is required.', example='237645726354'),
}

model GetChatQuestionRespResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    currentState?: string(name='currentState', example='PROCESSING'),
    questionList?: [ 
      {
        content?: string(name='content'),
        gmtCreate?: string(name='gmtCreate', example='2024-11-17 10:05:00'),
        oriContent?: string(name='oriContent'),
        reply?: string(name='reply'),
        sessionId?: string(name='sessionId', example='1732846760323001'),
        type?: string(name='type', example='PRODUCT_QA'),
        userId?: string(name='userId', example='39847834568436'),
        userName?: string(name='userName'),
      }
    ](name='questionList'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='44BD277A-87F9-5310-8D63-3E6645F1DA85'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-01-01 00:00:00'),
}

model GetChatQuestionRespResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetChatQuestionRespResponseBody(name='body'),
}

/**
 * @summary 获取问答结果
 *
 * @param request GetChatQuestionRespRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetChatQuestionRespResponse
 */
async function getChatQuestionRespWithOptions(workspaceId: string, request: GetChatQuestionRespRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetChatQuestionRespResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.batchId)) {
    body['batchId'] = request.batchId;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['sessionId'] = request.sessionId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetChatQuestionResp',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/virtualHuman/chat/query`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取问答结果
 *
 * @param request GetChatQuestionRespRequest
 * @return GetChatQuestionRespResponse
 */
async function getChatQuestionResp(workspaceId: string, request: GetChatQuestionRespRequest): GetChatQuestionRespResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getChatQuestionRespWithOptions(workspaceId, request, headers, runtime);
}

model GetDialogAnalysisResultRequest {
  asc?: boolean(name='asc', example='true'),
  endTime?: string(name='endTime', example='2024-09-23 09:20:02'),
  sessionIds?: [ string ](name='sessionIds'),
  startTime?: string(name='startTime', example='2024-09-14 09:11:00'),
  useUrl?: boolean(name='useUrl', example='true'),
}

model GetDialogAnalysisResultResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    dialogAnalysisRespList?: [ 
      {
        analysisResp?: {
          dialogExecPlan?: string(name='dialogExecPlan'),
          dialogLabels?: [ 
            {
              name?: string(name='name'),
              value?: string(name='value', example='0'),
            }
          ](name='dialogLabels'),
          dialogOpenAnalysis?: map[string]any(name='dialogOpenAnalysis'),
          dialogProcessAnalysis?: map[string]any(name='dialogProcessAnalysis'),
          dialogSop?: string(name='dialogSop'),
          dialogSummary?: string(name='dialogSummary'),
        }(name='analysisResp'),
        gmtCreate?: string(name='gmtCreate', example='2024-04-24 11:54:34'),
        ossUrl?: string(name='ossUrl', example='https://xxx.oss-cn-beijing.aliyuncs.com/dialog-analysis/2024-12-30/2/1826661605606129665'),
        sessionId?: string(name='sessionId', example='183764873624'),
        status?: string(name='status', example='running'),
      }
    ](name='dialogAnalysisRespList'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='88A006F0-B565-53BA-B38A-DBDF9D0B2935'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model GetDialogAnalysisResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDialogAnalysisResultResponseBody(name='body'),
}

/**
 * @summary 获取外呼会话分析结果
 *
 * @param request GetDialogAnalysisResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDialogAnalysisResultResponse
 */
async function getDialogAnalysisResultWithOptions(workspaceId: string, request: GetDialogAnalysisResultRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetDialogAnalysisResultResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.asc)) {
    body['asc'] = request.asc;
  }
  if (!Util.isUnset(request.endTime)) {
    body['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.sessionIds)) {
    body['sessionIds'] = request.sessionIds;
  }
  if (!Util.isUnset(request.startTime)) {
    body['startTime'] = request.startTime;
  }
  if (!Util.isUnset(request.useUrl)) {
    body['useUrl'] = request.useUrl;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetDialogAnalysisResult',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/virtualHuman/dialog/analysis`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取外呼会话分析结果
 *
 * @param request GetDialogAnalysisResultRequest
 * @return GetDialogAnalysisResultResponse
 */
async function getDialogAnalysisResult(workspaceId: string, request: GetDialogAnalysisResultRequest): GetDialogAnalysisResultResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getDialogAnalysisResultWithOptions(workspaceId, request, headers, runtime);
}

model GetDialogDetailRequest {
  sessionId?: string(name='sessionId', description='This parameter is required.', example='1906623923815534xxx'),
}

model GetDialogDetailResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    dialogueList?: [ 
      {
        content?: string(name='content'),
        customerId?: string(name='customerId', example='123761283'),
        customerServiceId?: string(name='customerServiceId', example='BOT'),
        customerServiceType?: string(name='customerServiceType', example='0'),
        hangUpDialog?: boolean(name='hangUpDialog', example='true'),
        id?: long(name='id', example='1742869659849'),
        intentCode?: string(name='intentCode', example='193874634xxx'),
        intentName?: string(name='intentName'),
        role?: string(name='role', example='0'),
        type?: string(name='type', example='text'),
      }
    ](name='dialogueList'),
    gmtCreate?: string(name='gmtCreate', example='2024-09-27 11:23:20'),
    status?: string(name='status', example='COMPLETED'),
    totalDialogTurns?: int32(name='totalDialogTurns', example='10'),
    validDialogTurns?: int32(name='validDialogTurns', example='5'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='5E3FBAF1-17AF-53B7-AF0A-CDCEEB6DE658'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model GetDialogDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDialogDetailResponseBody(name='body'),
}

/**
 * @summary 获取异步任务的结果
 *
 * @param request GetDialogDetailRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDialogDetailResponse
 */
async function getDialogDetailWithOptions(workspaceId: string, request: GetDialogDetailRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetDialogDetailResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.sessionId)) {
    query['sessionId'] = request.sessionId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetDialogDetail',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/virtualHuman/dialog/detail`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取异步任务的结果
 *
 * @param request GetDialogDetailRequest
 * @return GetDialogDetailResponse
 */
async function getDialogDetail(workspaceId: string, request: GetDialogDetailRequest): GetDialogDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getDialogDetailWithOptions(workspaceId, request, headers, runtime);
}

model GetDocumentChunkListRequest {
  chunkIdList?: [ string ](name='chunkIdList'),
  docId?: string(name='docId', description='This parameter is required.', example='182364872346'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='dsjgfdjgfxxx'),
  order?: string(name='order', example='desc'),
  orderBy?: string(name='orderBy', example='gmtCreate'),
  page?: int32(name='page', example='1'),
  pageSize?: int32(name='pageSize', example='10'),
  searchQuery?: string(name='searchQuery', example='test'),
}

model GetDocumentChunkListResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    currentPage?: long(name='currentPage', example='1'),
    pageSize?: long(name='pageSize', example='10'),
    records?: [ 
      {
        chunkId?: string(name='chunkId', example='28377468263482764'),
        chunkMeta?: map[string]any(name='chunkMeta', example='{"a":"1"}'),
        chunkOssUrl?: string(name='chunkOssUrl', example='oss-xxxx-hangzhou.com/test.pdf'),
        chunkText?: string(name='chunkText'),
        chunkType?: string(name='chunkType', example='text'),
        docId?: string(name='docId', example='8947387648356'),
        fileType?: string(name='fileType', example='pdf'),
        libraryId?: string(name='libraryId', example='jhsdvne'),
        libraryName?: string(name='libraryName'),
        nextChunkId?: string(name='nextChunkId', example='947538465'),
        pos?: [ 
          {
            axisArray?: [ double ](name='axisArray'),
            page?: int32(name='page', example='1'),
            textHighlightArea?: [ int32 ](name='textHighlightArea'),
          }
        ](name='pos'),
        preChunkId?: string(name='preChunkId', example='9848346548365'),
        score?: float(name='score', example='0.5'),
        title?: string(name='title', example='test'),
      }
    ](name='records'),
    totalPages?: long(name='totalPages', example='10'),
    totalRecords?: long(name='totalRecords', example='100'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='2B8F6DC9-6FAF-576F-9095-CCD90FB2BDDF'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model GetDocumentChunkListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDocumentChunkListResponseBody(name='body'),
}

/**
 * @summary 获取文档的chunk列表
 *
 * @param request GetDocumentChunkListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDocumentChunkListResponse
 */
async function getDocumentChunkListWithOptions(workspaceId: string, request: GetDocumentChunkListRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetDocumentChunkListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.chunkIdList)) {
    body['chunkIdList'] = request.chunkIdList;
  }
  if (!Util.isUnset(request.docId)) {
    body['docId'] = request.docId;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }
  if (!Util.isUnset(request.order)) {
    body['order'] = request.order;
  }
  if (!Util.isUnset(request.orderBy)) {
    body['orderBy'] = request.orderBy;
  }
  if (!Util.isUnset(request.page)) {
    body['page'] = request.page;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.searchQuery)) {
    body['searchQuery'] = request.searchQuery;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetDocumentChunkList',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/getDocumentChunk`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取文档的chunk列表
 *
 * @param request GetDocumentChunkListRequest
 * @return GetDocumentChunkListResponse
 */
async function getDocumentChunkList(workspaceId: string, request: GetDocumentChunkListRequest): GetDocumentChunkListResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getDocumentChunkListWithOptions(workspaceId, request, headers, runtime);
}

model GetDocumentListRequest {
  libraryId?: string(name='libraryId', description='This parameter is required.', example='3akzl28vap'),
  page?: int32(name='page', example='1'),
  pageSize?: int32(name='pageSize', example='10'),
  status?: string(name='status'),
}

model GetDocumentListResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    currentPage?: long(name='currentPage', example='1'),
    pageSize?: long(name='pageSize', example='10'),
    records?: [ 
      {
        docId?: string(name='docId', example='8326748346'),
        documentMeta?: map[string]any(name='documentMeta'),
        fileType?: string(name='fileType', example='pdf'),
        gmtCreate?: string(name='gmtCreate', example='2024-01-01 00:00:00'),
        gmtModified?: string(name='gmtModified', example='2024-01-01 00:00:00'),
        libraryId?: string(name='libraryId', example='skjdhshbv'),
        statusCode?: string(name='statusCode', example='WaitRefresh'),
        title?: string(name='title', example='test'),
        url?: string(name='url', example='null'),
      }
    ](name='records'),
    totalPages?: long(name='totalPages', example='10'),
    totalRecords?: long(name='totalRecords', example='100'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='5E3FBAF1-17AF-53B7-AF0A-CDCEEB6DE658'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model GetDocumentListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDocumentListResponseBody(name='body'),
}

/**
 * @summary 分页查询文档库的文档列表
 *
 * @param request GetDocumentListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDocumentListResponse
 */
async function getDocumentListWithOptions(workspaceId: string, request: GetDocumentListRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetDocumentListResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.libraryId)) {
    query['libraryId'] = request.libraryId;
  }
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.status)) {
    query['status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetDocumentList',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/listDocument`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 分页查询文档库的文档列表
 *
 * @param request GetDocumentListRequest
 * @return GetDocumentListResponse
 */
async function getDocumentList(workspaceId: string, request: GetDocumentListRequest): GetDocumentListResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getDocumentListWithOptions(workspaceId, request, headers, runtime);
}

model GetDocumentUrlRequest {
  documentId?: string(name='documentId', description='This parameter is required.', example='12681367362'),
}

model GetDocumentUrlResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: string(name='data', example='https://path_to_file'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='66249B43-8C2B-5EE7-AE78-B382306621C6'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-01-01 00:00:00'),
}

model GetDocumentUrlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDocumentUrlResponseBody(name='body'),
}

/**
 * @summary 获取文档URL
 *
 * @param request GetDocumentUrlRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDocumentUrlResponse
 */
async function getDocumentUrlWithOptions(workspaceId: string, request: GetDocumentUrlRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetDocumentUrlResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.documentId)) {
    query['documentId'] = request.documentId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetDocumentUrl',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/document/url`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取文档URL
 *
 * @param request GetDocumentUrlRequest
 * @return GetDocumentUrlResponse
 */
async function getDocumentUrl(workspaceId: string, request: GetDocumentUrlRequest): GetDocumentUrlResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getDocumentUrlWithOptions(workspaceId, request, headers, runtime);
}

model GetFilterDocumentListRequest {
  and?: [ 
    {
      boost?: float(name='boost', example='1'),
      key?: string(name='key', example='company'),
      operator?: string(name='operator', example='eq'),
      value?: string(name='value', example='alibaba'),
    }
  ](name='and'),
  docIdList?: [ string ](name='docIdList'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='cjshcxxxx'),
  or?: [ 
    {
      boost?: float(name='boost', example='1'),
      key?: string(name='key', example='company'),
      operator?: string(name='operator', example='contains'),
      value?: string(name='value', example='alibaba'),
    }
  ](name='or'),
  page?: int32(name='page', example='1'),
  pageSize?: int32(name='pageSize', example='10'),
  status?: [ string ](name='status'),
}

model GetFilterDocumentListResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    currentPage?: long(name='currentPage', example='1'),
    pageSize?: long(name='pageSize', example='10'),
    records?: [ 
      {
        docId?: string(name='docId', example='29368126816'),
        documentMeta?: map[string]any(name='documentMeta', example='{"a": "1"}'),
        fileType?: string(name='fileType', example='pdf'),
        gmtCreate?: string(name='gmtCreate', example='2024-01-01 00:00:00'),
        gmtModified?: string(name='gmtModified', example='2024-01-01 00:00:00'),
        libraryId?: string(name='libraryId', example='sdfgsjdfg'),
        statusCode?: string(name='statusCode', example='WaitRefresh'),
        title?: string(name='title'),
        url?: string(name='url', example='null'),
      }
    ](name='records'),
    totalPages?: long(name='totalPages', example='10'),
    totalRecords?: long(name='totalRecords', example='100'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='7ADF010C-FD89-569D-A079-2D4D5247E943'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-01-01 00:00:00'),
}

model GetFilterDocumentListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFilterDocumentListResponseBody(name='body'),
}

/**
 * @summary 带条件的分页查询文档库的文档列表
 *
 * @param request GetFilterDocumentListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFilterDocumentListResponse
 */
async function getFilterDocumentListWithOptions(workspaceId: string, request: GetFilterDocumentListRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetFilterDocumentListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.and)) {
    body['and'] = request.and;
  }
  if (!Util.isUnset(request.docIdList)) {
    body['docIdList'] = request.docIdList;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }
  if (!Util.isUnset(request.or)) {
    body['or'] = request.or;
  }
  if (!Util.isUnset(request.page)) {
    body['page'] = request.page;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.status)) {
    body['status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetFilterDocumentList',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/filterDocument`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 带条件的分页查询文档库的文档列表
 *
 * @param request GetFilterDocumentListRequest
 * @return GetFilterDocumentListResponse
 */
async function getFilterDocumentList(workspaceId: string, request: GetFilterDocumentListRequest): GetFilterDocumentListResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getFilterDocumentListWithOptions(workspaceId, request, headers, runtime);
}

model GetHistoryListByBizTypeRequest {
  bizId?: string(name='bizId', description='This parameter is required.', example='GysYBsxx'),
  bizType?: string(name='bizType', description='This parameter is required.', example='LibraryChat'),
  page?: int32(name='page', example='1'),
  pageSize?: int32(name='pageSize', example='10'),
}

model GetHistoryListByBizTypeResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    currentPage?: long(name='currentPage', example='1'),
    pageSize?: long(name='pageSize', example='10'),
    records?: [ 
      {
        bizId?: string(name='bizId', example='GysYBsxx'),
        bizType?: string(name='bizType', example='LibraryChat'),
        extraMessage?: any(name='extraMessage', example='null'),
        gmtCreate?: string(name='gmtCreate', example='2024-01-01 00:00:00'),
        gmtModified?: string(name='gmtModified', example='2024-01-01 00:00:00'),
        id?: long(name='id', example='210'),
        llmAnswer?: string(name='llmAnswer'),
        llmPrompt?: string(name='llmPrompt'),
        llmType?: string(name='llmType', example='qwen-max'),
        sessionId?: string(name='sessionId', example='null'),
        userQuery?: string(name='userQuery'),
      }
    ](name='records'),
    totalPages?: long(name='totalPages', example='10'),
    totalRecords?: long(name='totalRecords', example='100'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='9DF9B3F3-9FFE-52CB-A8DC-F7BD5F842F0E'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-01-01 00:00:00'),
}

model GetHistoryListByBizTypeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHistoryListByBizTypeResponseBody(name='body'),
}

/**
 * @summary 分页查询文档库列表
 *
 * @param request GetHistoryListByBizTypeRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHistoryListByBizTypeResponse
 */
async function getHistoryListByBizTypeWithOptions(workspaceId: string, request: GetHistoryListByBizTypeRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetHistoryListByBizTypeResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.bizId)) {
    query['bizId'] = request.bizId;
  }
  if (!Util.isUnset(request.bizType)) {
    query['bizType'] = request.bizType;
  }
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetHistoryListByBizType',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/history/list`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 分页查询文档库列表
 *
 * @param request GetHistoryListByBizTypeRequest
 * @return GetHistoryListByBizTypeResponse
 */
async function getHistoryListByBizType(workspaceId: string, request: GetHistoryListByBizTypeRequest): GetHistoryListByBizTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getHistoryListByBizTypeWithOptions(workspaceId, request, headers, runtime);
}

model GetLibraryRequest {
  libraryId?: string(name='libraryId', description='This parameter is required.', example='cjshcxxxx'),
}

model GetLibraryResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    description?: string(name='description'),
    documentCount?: long(name='documentCount', example='10'),
    gmtCreate?: string(name='gmtCreate', example='2024-01-01 00:00:00'),
    gmtModified?: string(name='gmtModified', example='2024-01-01 00:00:00'),
    id?: string(name='id', example='19386728376'),
    indexSetting?: {
      chunkStrategy?: {
        docTreeSplit?: boolean(name='docTreeSplit', example='true'),
        docTreeSplitSize?: int32(name='docTreeSplitSize', example='160'),
        enhanceGraph?: boolean(name='enhanceGraph', example='true'),
        enhanceTable?: boolean(name='enhanceTable', example='true'),
        overlap?: int32(name='overlap', example='40'),
        sentenceSplit?: boolean(name='sentenceSplit', example='true'),
        sentenceSplitSize?: int32(name='sentenceSplitSize', example='160'),
        size?: int32(name='size', example='256'),
        split?: boolean(name='split', example='true'),
      }(name='chunkStrategy'),
      modelConfig?: {
        temperature?: double(name='temperature', example='0.8'),
        topP?: double(name='topP', description='topP', example='0.8'),
      }(name='modelConfig'),
      promptRoleStyle?: string(name='promptRoleStyle'),
      queryEnhancer?: {
        enableFollowUp?: boolean(name='enableFollowUp', example='true'),
        enableMultiQuery?: boolean(name='enableMultiQuery', example='true'),
        enableOpenQa?: boolean(name='enableOpenQa', example='true'),
        enableQueryRewrite?: boolean(name='enableQueryRewrite', example='true'),
        enableSession?: boolean(name='enableSession', example='true'),
        localKnowledgeId?: string(name='localKnowledgeId', example='2836482634'),
        withDocumentReference?: boolean(name='withDocumentReference', example='true'),
      }(name='queryEnhancer'),
      recallStrategy?: {
        documentRankType?: string(name='documentRankType', example='model'),
        limit?: int32(name='limit', example='10'),
      }(name='recallStrategy'),
      textIndexSetting?: {
        category?: string(name='category', example='ElasticSearch'),
        enable?: boolean(name='enable', example='true'),
        indexAnalyzer?: string(name='indexAnalyzer', example='IkMaxWord'),
        rankThreshold?: double(name='rankThreshold', example='null'),
        searchAnalyzer?: string(name='searchAnalyzer', example='Standard'),
        topK?: int32(name='topK', example='10'),
      }(name='textIndexSetting'),
      vectorIndexSetting?: {
        category?: string(name='category', example='ADB'),
        embeddingType?: string(name='embeddingType', example='DashScope'),
        enable?: boolean(name='enable', example='true'),
        rankThreshold?: double(name='rankThreshold', example='null'),
        topK?: int32(name='topK', example='10'),
      }(name='vectorIndexSetting'),
    }(name='indexSetting'),
    libraryName?: string(name='libraryName'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='44BD277A-87F9-5310-8D63-3E6645F1DA85'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-01-01 00:00:00'),
}

model GetLibraryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetLibraryResponseBody(name='body'),
}

/**
 * @summary 获取文档库配置详情
 *
 * @param request GetLibraryRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetLibraryResponse
 */
async function getLibraryWithOptions(workspaceId: string, request: GetLibraryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetLibraryResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.libraryId)) {
    query['libraryId'] = request.libraryId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetLibrary',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/get`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取文档库配置详情
 *
 * @param request GetLibraryRequest
 * @return GetLibraryResponse
 */
async function getLibrary(workspaceId: string, request: GetLibraryRequest): GetLibraryResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getLibraryWithOptions(workspaceId, request, headers, runtime);
}

model GetLibraryListRequest {
  page?: int32(name='page', example='1'),
  pageSize?: int32(name='pageSize', example='10'),
  query?: string(name='query'),
}

model GetLibraryListResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    currentPage?: long(name='currentPage', example='1'),
    pageSize?: long(name='pageSize', example='10'),
    records?: [ 
      {
        description?: string(name='description'),
        documentCount?: long(name='documentCount', example='10'),
        gmtCreate?: string(name='gmtCreate', example='2024-01-01 00:00:00'),
        gmtModified?: string(name='gmtModified', example='2024-01-01 00:00:00'),
        id?: string(name='id', example='24vs4aa42jv1rg7'),
        indexSetting?: {
          chunkStrategy?: {
            docTreeSplit?: boolean(name='docTreeSplit', example='true'),
            docTreeSplitSize?: int32(name='docTreeSplitSize', example='160'),
            enhanceGraph?: boolean(name='enhanceGraph', example='true'),
            enhanceTable?: boolean(name='enhanceTable', example='true'),
            overlap?: int32(name='overlap', example='40'),
            sentenceSplit?: boolean(name='sentenceSplit', example='true'),
            sentenceSplitSize?: int32(name='sentenceSplitSize', example='160'),
            size?: int32(name='size', example='256'),
            split?: boolean(name='split', example='true'),
          }(name='chunkStrategy'),
          modelConfig?: {
            temperature?: double(name='temperature', example='0.8'),
            topP?: double(name='topP', description='topP', example='0.8'),
          }(name='modelConfig'),
          promptRoleStyle?: string(name='promptRoleStyle'),
          queryEnhancer?: {
            enableFollowUp?: boolean(name='enableFollowUp', example='true'),
            enableMultiQuery?: boolean(name='enableMultiQuery', example='true'),
            enableOpenQa?: boolean(name='enableOpenQa', example='true'),
            enableQueryRewrite?: boolean(name='enableQueryRewrite', example='true'),
            enableSession?: boolean(name='enableSession', example='true'),
            localKnowledgeId?: string(name='localKnowledgeId', example='sdbcjsbc'),
            withDocumentReference?: boolean(name='withDocumentReference', example='true'),
          }(name='queryEnhancer'),
          recallStrategy?: {
            documentRankType?: string(name='documentRankType', example='model'),
            limit?: int32(name='limit', example='10'),
          }(name='recallStrategy'),
          textIndexSetting?: {
            category?: string(name='category', example='ElasticSearch'),
            enable?: boolean(name='enable', example='true'),
            indexAnalyzer?: string(name='indexAnalyzer', example='Standard'),
            rankThreshold?: double(name='rankThreshold', example='null'),
            searchAnalyzer?: string(name='searchAnalyzer', example='Standard'),
            topK?: int32(name='topK', example='10'),
          }(name='textIndexSetting'),
          vectorIndexSetting?: {
            category?: string(name='category', example='ADB'),
            embeddingType?: string(name='embeddingType', example='DashScope'),
            enable?: boolean(name='enable', example='true'),
            rankThreshold?: double(name='rankThreshold', example='null'),
            topK?: int32(name='topK', example='10'),
          }(name='vectorIndexSetting'),
        }(name='indexSetting'),
        libraryName?: string(name='libraryName'),
      }
    ](name='records'),
    totalPages?: long(name='totalPages', example='10'),
    totalRecords?: long(name='totalRecords', example='100'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='0a06dfe817156528535968405edce3'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-01-01 00:00:00'),
}

model GetLibraryListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetLibraryListResponseBody(name='body'),
}

/**
 * @summary 分页查询文档库列表
 *
 * @param request GetLibraryListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetLibraryListResponse
 */
async function getLibraryListWithOptions(workspaceId: string, request: GetLibraryListRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetLibraryListResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.query)) {
    query['query'] = request.query;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetLibraryList',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/list`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 分页查询文档库列表
 *
 * @param request GetLibraryListRequest
 * @return GetLibraryListResponse
 */
async function getLibraryList(workspaceId: string, request: GetLibraryListRequest): GetLibraryListResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getLibraryListWithOptions(workspaceId, request, headers, runtime);
}

model GetParseResultRequest {
  docId?: string(name='docId', description='This parameter is required.', example='873648346573245'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='sjdgdsfg'),
  useUrlResult?: boolean(name='useUrlResult'),
}

model GetParseResultResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    fileType?: string(name='fileType', example='pdf'),
    providerType?: string(name='providerType', example='null'),
    requestId?: string(name='requestId', example='b0a202e2-5031-4589-a6d7-39185f0d8d01'),
    result?: map[string]any(name='result', example='{
          "Status": "Success",
          "Data": {},
          "Message": null,
          "TaskId": "docmind-20240601-123abc"
        }'),
    resultUrl?: string(name='resultUrl'),
    status?: string(name='status', example='WaitRefresh'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='0abb793617204049360065953ec6dd'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model GetParseResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetParseResultResponseBody(name='body'),
}

/**
 * @summary 获取解析结果
 *
 * @param request GetParseResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetParseResultResponse
 */
async function getParseResultWithOptions(workspaceId: string, request: GetParseResultRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetParseResultResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.docId)) {
    body['docId'] = request.docId;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }
  if (!Util.isUnset(request.useUrlResult)) {
    body['useUrlResult'] = request.useUrlResult;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetParseResult',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/document/getParseResult`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取解析结果
 *
 * @param request GetParseResultRequest
 * @return GetParseResultResponse
 */
async function getParseResult(workspaceId: string, request: GetParseResultRequest): GetParseResultResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getParseResultWithOptions(workspaceId, request, headers, runtime);
}

model GetQualityCheckTaskResultRequest {
  taskId?: string(name='taskId', description='This parameter is required.', example='17071319'),
}

model GetQualityCheckTaskResultResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    conversationList?: {
      callType?: string(name='callType', example='1'),
      customerId?: string(name='customerId', example='234234'),
      customerName?: string(name='customerName'),
      customerServiceId?: string(name='customerServiceId', example='23984763826'),
      customerServiceName?: string(name='customerServiceName'),
      dialogueList?: [ 
        {
          begin?: int32(name='begin', example='0'),
          beginTime?: string(name='beginTime', example='2024-09-27 11:23:20'),
          content?: string(name='content'),
          customerId?: string(name='customerId', example='null'),
          customerServiceId?: string(name='customerServiceId'),
          customerServiceType?: string(name='customerServiceType', example='0'),
          end?: int32(name='end', example='0'),
          id?: int32(name='id', example='1'),
          role?: string(name='role', example='0'),
          type?: string(name='type', example='TEXT'),
        }
      ](name='dialogueList'),
      gmtService?: string(name='gmtService', example='2024-09-27 11:23:20'),
    }(name='conversationList'),
    gmtCreate?: string(name='gmtCreate', example='2024-09-27 11:23:20'),
    gmtEnd?: string(name='gmtEnd', example='2024-09-27 11:23:20'),
    gmtStart?: string(name='gmtStart', example='2024-09-27 11:23:20'),
    qualityCheckList?: [ 
      {
        bizType?: string(name='bizType'),
        checkExplanation?: string(name='checkExplanation'),
        checkPassed?: string(name='checkPassed', example='PASSED'),
        checkProcess?: string(name='checkProcess'),
        checked?: string(name='checked', example='HIT'),
        gmtEnd?: string(name='gmtEnd', example='2024-05-23 14:57:50'),
        gmtStart?: string(name='gmtStart', example='2024-05-23 14:57:50'),
        mode?: string(name='mode', example='0'),
        originDialogue?: [ 
          {
            begin?: int32(name='begin', example='0'),
            beginTime?: string(name='beginTime', example='2024-05-23 14:57:50'),
            content?: string(name='content'),
            customerId?: string(name='customerId', example='xxx'),
            customerServiceId?: string(name='customerServiceId', example='23876432'),
            customerServiceType?: string(name='customerServiceType', example='0'),
            end?: int32(name='end', example='0'),
            id?: int32(name='id', example='1'),
            role?: string(name='role', example='0'),
            type?: string(name='type', example='TEXT'),
          }
        ](name='originDialogue'),
        qualityGroupId?: string(name='qualityGroupId', example='warning_customers'),
        ruleDescription?: string(name='ruleDescription'),
        ruleId?: string(name='ruleId', example='wcm_start'),
        ruleType?: string(name='ruleType'),
        subNodeCol?: [ any ](name='subNodeCol'),
      }
    ](name='qualityCheckList'),
    status?: string(name='status', example='INIT'),
    taskId?: string(name='taskId', example='1703557101831'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='67C7021A-D268-553D-8C15-A087B9604028'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-01-01 00:00:00'),
}

model GetQualityCheckTaskResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetQualityCheckTaskResultResponseBody(name='body'),
}

/**
 * @summary 获取异步任务的结果
 *
 * @param request GetQualityCheckTaskResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetQualityCheckTaskResultResponse
 */
async function getQualityCheckTaskResultWithOptions(workspaceId: string, request: GetQualityCheckTaskResultRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetQualityCheckTaskResultResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.taskId)) {
    query['taskId'] = request.taskId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetQualityCheckTaskResult',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/qualitycheck/task/query`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取异步任务的结果
 *
 * @param request GetQualityCheckTaskResultRequest
 * @return GetQualityCheckTaskResultResponse
 */
async function getQualityCheckTaskResult(workspaceId: string, request: GetQualityCheckTaskResultRequest): GetQualityCheckTaskResultResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getQualityCheckTaskResultWithOptions(workspaceId, request, headers, runtime);
}

model GetSummaryTaskResultRequest {
  taskId?: string(name='taskId', description='This parameter is required.', example='17071319'),
}

model GetSummaryTaskResultResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    choices?: [ 
      {
        finishReason?: string(name='finishReason', example='stop'),
        index?: int32(name='index', example='0'),
        message?: {
          content?: string(name='content'),
          role?: string(name='role', example='assistant'),
          toolCalls?: [  map[string]any ](name='toolCalls'),
        }(name='message'),
      }
    ](name='choices'),
    created?: long(name='created', example='1726285125915'),
    id?: string(name='id', example='1202'),
    modelId?: string(name='modelId', example='qwen-max'),
    requestId?: string(name='requestId', example='0bc13a9517168617617186457e401f'),
    time?: string(name='time', example='2024-04-24 11:54:34'),
    totalTokens?: int32(name='totalTokens', example='300'),
    usage?: {
      imageCount?: int32(name='imageCount', example='0'),
      imageTokens?: int32(name='imageTokens', example='0'),
      inputTokens?: int32(name='inputTokens', example='100'),
      outputTokens?: int32(name='outputTokens', example='200'),
      totalTokens?: int32(name='totalTokens', example='300'),
    }(name='usage'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='0bc13a9517168617617186457e401f'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model GetSummaryTaskResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSummaryTaskResultResponseBody(name='body'),
}

/**
 * @summary 获取财报总结任务结果
 *
 * @param request GetSummaryTaskResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSummaryTaskResultResponse
 */
async function getSummaryTaskResultWithOptions(workspaceId: string, request: GetSummaryTaskResultRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetSummaryTaskResultResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.taskId)) {
    query['taskId'] = request.taskId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSummaryTaskResult',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/task/summary/result`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取财报总结任务结果
 *
 * @param request GetSummaryTaskResultRequest
 * @return GetSummaryTaskResultResponse
 */
async function getSummaryTaskResult(workspaceId: string, request: GetSummaryTaskResultRequest): GetSummaryTaskResultResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getSummaryTaskResultWithOptions(workspaceId, request, headers, runtime);
}

model GetTaskResultRequest {
  taskId?: string(name='taskId', description='This parameter is required.', example='17071319'),
}

model GetTaskResultResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: map[string]any(name='data', example='{
  "file_url": "https://finllmworks.oss-cn-zhangjiakou.aliyuncs.com/render_pdf/5336180997111160501.pdf"
}'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='9D5D6BB5-BEAE-53C8-A70A-7275CC1F856C'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model GetTaskResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTaskResultResponseBody(name='body'),
}

/**
 * @summary 获取异步任务结果
 *
 * @param request GetTaskResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTaskResultResponse
 */
async function getTaskResultWithOptions(workspaceId: string, request: GetTaskResultRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskResultResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.taskId)) {
    query['taskId'] = request.taskId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTaskResult',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/task/result`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取异步任务结果
 *
 * @param request GetTaskResultRequest
 * @return GetTaskResultResponse
 */
async function getTaskResult(workspaceId: string, request: GetTaskResultRequest): GetTaskResultResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskResultWithOptions(workspaceId, request, headers, runtime);
}

model GetTaskStatusRequest {
  taskId?: string(name='taskId', description='This parameter is required.'),
}

model GetTaskStatusResponseBody = {
  cost?: long(name='cost'),
  data?: string(name='data'),
  dataType?: string(name='dataType'),
  errCode?: string(name='errCode'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
  success?: boolean(name='success'),
  time?: string(name='time'),
}

model GetTaskStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTaskStatusResponseBody(name='body'),
}

/**
 * @summary 获取财报总结任务结果
 *
 * @param request GetTaskStatusRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTaskStatusResponse
 */
async function getTaskStatusWithOptions(workspaceId: string, request: GetTaskStatusRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskStatusResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.taskId)) {
    query['taskId'] = request.taskId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTaskStatus',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/task/status`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取财报总结任务结果
 *
 * @param request GetTaskStatusRequest
 * @return GetTaskStatusResponse
 */
async function getTaskStatus(workspaceId: string, request: GetTaskStatusRequest): GetTaskStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskStatusWithOptions(workspaceId, request, headers, runtime);
}

model InvokePluginRequest {
  params?: map[string]any(name='params'),
  pluginId?: string(name='pluginId', example='3mj87da7zr'),
}

model InvokePluginResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: map[string]any(name='data', example='{\\\\"jobWaiting\\\\": [0, 0], \\\\"timestamps\\\\": [1713383820, 1713383880], \\\\"jobUsage\\\\": [0, 0], \\\\"quotaUsage\\\\": [123, 32]}'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='915AAAB9-4908-5224-9E53-9E9D7D0AA94B'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model InvokePluginResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InvokePluginResponseBody(name='body'),
}

/**
 * @summary 插件调试接口
 *
 * @param request InvokePluginRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return InvokePluginResponse
 */
async function invokePluginWithOptions(workspaceId: string, request: InvokePluginRequest, headers: map[string]string, runtime: Util.RuntimeOptions): InvokePluginResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.params)) {
    body['params'] = request.params;
  }
  if (!Util.isUnset(request.pluginId)) {
    body['pluginId'] = request.pluginId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'InvokePlugin',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/plugin/invoke`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 插件调试接口
 *
 * @param request InvokePluginRequest
 * @return InvokePluginResponse
 */
async function invokePlugin(workspaceId: string, request: InvokePluginRequest): InvokePluginResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return invokePluginWithOptions(workspaceId, request, headers, runtime);
}

model PreviewDocumentRequest {
  documentId?: string(name='documentId', description='This parameter is required.', example='8326472354762354'),
}

model PreviewDocumentResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    previewType?: string(name='previewType', example='pdf'),
    title?: string(name='title', example='test'),
    uploadTime?: string(name='uploadTime', example='2024-01-01 00:00:00'),
    url?: string(name='url', example='https://agi.alicdn.com/user/d0o/d3c1f50d-a6c2-49b3-b0c8-3e613c3f20ee_16872_3236784461.png'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='ff551395-1c8a-4f30-8ffd-ef7e87c70b4c'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model PreviewDocumentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PreviewDocumentResponseBody(name='body'),
}

/**
 * @summary 获取文档预览
 *
 * @param request PreviewDocumentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return PreviewDocumentResponse
 */
async function previewDocumentWithOptions(workspaceId: string, request: PreviewDocumentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PreviewDocumentResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.documentId)) {
    query['documentId'] = request.documentId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PreviewDocument',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/document/preview`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取文档预览
 *
 * @param request PreviewDocumentRequest
 * @return PreviewDocumentResponse
 */
async function previewDocument(workspaceId: string, request: PreviewDocumentRequest): PreviewDocumentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return previewDocumentWithOptions(workspaceId, request, headers, runtime);
}

model ReIndexRequest {
  documentId?: string(name='documentId', description='This parameter is required.', example='8326472354762354'),
}

model ReIndexResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: string(name='data', example='True'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='32FFC91D-0A9F-585A-B84F-8A54C5187035'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model ReIndexResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReIndexResponseBody(name='body'),
}

/**
 * @summary 重新索引
 *
 * @param request ReIndexRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReIndexResponse
 */
async function reIndexWithOptions(workspaceId: string, request: ReIndexRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ReIndexResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.documentId)) {
    query['documentId'] = request.documentId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ReIndex',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/document/reIndex`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 重新索引
 *
 * @param request ReIndexRequest
 * @return ReIndexResponse
 */
async function reIndex(workspaceId: string, request: ReIndexRequest): ReIndexResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return reIndexWithOptions(workspaceId, request, headers, runtime);
}

model RealTimeDialogRequest {
  analysis?: boolean(name='analysis', example='false'),
  bizType?: string(name='bizType', example='mixIntentChat'),
  conversationModel?: [ 
    {
      begin?: int32(name='begin', example='5'),
      beginTime?: string(name='beginTime', example='2024-11-08 09:51:16'),
      content?: string(name='content', description='This parameter is required.'),
      customerId?: string(name='customerId', example='98457834685635'),
      customerServiceId?: string(name='customerServiceId', example='1374683645635'),
      customerServiceType?: string(name='customerServiceType', example='0'),
      end?: int32(name='end', example='10'),
      role?: int32(name='role', description='This parameter is required.', example='0'),
      type?: string(name='type', description='This parameter is required.', example='audio'),
    }
  ](name='conversationModel', description='This parameter is required.'),
  dialogMemoryTurns?: int32(name='dialogMemoryTurns', example='3'),
  metaData?: map[string]any(name='metaData'),
  opType?: string(name='opType', example='common'),
  recommend?: boolean(name='recommend', example='false'),
  scriptContentPlayed?: string(name='scriptContentPlayed'),
  sessionId?: string(name='sessionId', description='This parameter is required.', example='237645726354'),
  stream?: boolean(name='stream', example='false'),
  userVad?: boolean(name='userVad'),
}

model RealTimeDialogResponseBody = {
  choices?: [ 
    {
      delta?: {
        analysisProcess?: string(name='analysisProcess', example='null'),
        callTime?: string(name='callTime', description='time', example='null'),
        hangUpDialog?: boolean(name='hangUpDialog', example='false'),
        intentionCode?: string(name='intentionCode', example='1853360771162058752'),
        intentionName?: string(name='intentionName'),
        intentionScript?: string(name='intentionScript'),
        interrupt?: boolean(name='interrupt'),
        recommendIntention?: string(name='recommendIntention', example='null'),
        recommendScript?: string(name='recommendScript', example='null'),
        selfDirectedScript?: string(name='selfDirectedScript'),
        selfDirectedScriptFullContent?: string(name='selfDirectedScriptFullContent'),
      }(name='delta'),
      finishReason?: string(name='finishReason', example='stop'),
      index?: int32(name='index', example='0'),
      message?: {
        analysisProcess?: string(name='analysisProcess', example='null'),
        callTime?: string(name='callTime', description='time', example='1735139569523'),
        hangUpDialog?: boolean(name='hangUpDialog', example='false'),
        intentionCode?: string(name='intentionCode', example='1853360771162058752'),
        intentionName?: string(name='intentionName'),
        intentionScript?: string(name='intentionScript'),
        interrupt?: boolean(name='interrupt'),
        recommendIntention?: string(name='recommendIntention', example='null'),
        recommendScript?: string(name='recommendScript', example='null'),
        selfDirectedScript?: string(name='selfDirectedScript', example='null'),
        selfDirectedScriptFullContent?: string(name='selfDirectedScriptFullContent'),
      }(name='message'),
    }
  ](name='choices'),
  created?: string(name='created', example='1735139569523'),
  id?: string(name='id', example='eb2b6139-ddf1-91a0-a47f-df7617ae9032'),
  requestId?: string(name='requestId', example='5E3FBAF1-17AF-53B7-AF0A-CDCEEB6DE658'),
  success?: boolean(name='success', example='true'),
}

model RealTimeDialogResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RealTimeDialogResponseBody(name='body'),
}

/**
 * @summary 实时对话
 *
 * @param request RealTimeDialogRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RealTimeDialogResponse
 */
async function realTimeDialogWithOptions(workspaceId: string, request: RealTimeDialogRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RealTimeDialogResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.analysis)) {
    body['analysis'] = request.analysis;
  }
  if (!Util.isUnset(request.bizType)) {
    body['bizType'] = request.bizType;
  }
  if (!Util.isUnset(request.conversationModel)) {
    body['conversationModel'] = request.conversationModel;
  }
  if (!Util.isUnset(request.dialogMemoryTurns)) {
    body['dialogMemoryTurns'] = request.dialogMemoryTurns;
  }
  if (!Util.isUnset(request.metaData)) {
    body['metaData'] = request.metaData;
  }
  if (!Util.isUnset(request.opType)) {
    body['opType'] = request.opType;
  }
  if (!Util.isUnset(request.recommend)) {
    body['recommend'] = request.recommend;
  }
  if (!Util.isUnset(request.scriptContentPlayed)) {
    body['scriptContentPlayed'] = request.scriptContentPlayed;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['sessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.stream)) {
    body['stream'] = request.stream;
  }
  if (!Util.isUnset(request.userVad)) {
    body['userVad'] = request.userVad;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RealTimeDialog',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/realtime/dialog/chat`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 实时对话
 *
 * @param request RealTimeDialogRequest
 * @return RealTimeDialogResponse
 */
async function realTimeDialog(workspaceId: string, request: RealTimeDialogRequest): RealTimeDialogResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return realTimeDialogWithOptions(workspaceId, request, headers, runtime);
}

model RebuildTaskRequest {
  taskIds?: [ string ](name='taskIds', description='This parameter is required.'),
}

model RebuildTaskResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: [  map[string]any ](name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='EF4B5C9B-3BC8-5171-A47B-4C5CF3DC3258'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model RebuildTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RebuildTaskResponseBody(name='body'),
}

/**
 * @summary 重建任务
 *
 * @param request RebuildTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RebuildTaskResponse
 */
async function rebuildTaskWithOptions(workspaceId: string, request: RebuildTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RebuildTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.taskIds)) {
    body['taskIds'] = request.taskIds;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RebuildTask',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/task/rebuild`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 重建任务
 *
 * @param request RebuildTaskRequest
 * @return RebuildTaskResponse
 */
async function rebuildTask(workspaceId: string, request: RebuildTaskRequest): RebuildTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return rebuildTaskWithOptions(workspaceId, request, headers, runtime);
}

model RecallDocumentRequest {
  filters?: [ 
    {
      and?: [ 
        {
          boost?: float(name='boost', example='20'),
          key?: string(name='key', example='docType'),
          operator?: string(name='operator', example='contains'),
          value?: string(name='value'),
        }
      ](name='and'),
      chunkType?: string(name='chunkType', example='Text'),
      docIdList?: [ string ](name='docIdList'),
      libraryId?: string(name='libraryId', description='This parameter is required.', example='sdbjhvs'),
      or?: [ 
        {
          boost?: float(name='boost', example='30'),
          key?: string(name='key', example='researcher'),
          operator?: string(name='operator', example='eq'),
          value?: string(name='value', example='zhangsan'),
        }
      ](name='or'),
      status?: [ string ](name='status'),
    }
  ](name='filters'),
  query?: string(name='query', description='This parameter is required.'),
  rearrangement?: boolean(name='rearrangement', example='false'),
  topK?: int32(name='topK', example='10'),
}

model RecallDocumentResponseBody = {
  cost?: long(name='cost', example='0'),
  data?: {
    chunkList?: [ 
      {
        chunkId?: string(name='chunkId', example='823746762354'),
        chunkMeta?: map[string]any(name='chunkMeta', example='{"a":"1"}'),
        chunkOssUrl?: string(name='chunkOssUrl', example='http://oss-xxx-hangzhou.com/xxx'),
        chunkText?: string(name='chunkText'),
        chunkType?: string(name='chunkType', example='text'),
        docId?: string(name='docId', example='839468263472'),
        fileType?: string(name='fileType', example='pdf'),
        libraryId?: string(name='libraryId', example='dscsbdsk'),
        libraryName?: string(name='libraryName'),
        nextChunkId?: string(name='nextChunkId', example='982374872364'),
        pos?: [ 
          {
            axisArray?: [ double ](name='axisArray'),
            page?: int32(name='page', example='1'),
            textHighlightArea?: [ int32 ](name='textHighlightArea'),
          }
        ](name='pos'),
        preChunkId?: string(name='preChunkId', example='827364827364832'),
        score?: float(name='score', example='0.5'),
        title?: string(name='title', example='test'),
      }
    ](name='chunkList'),
    chunkPartList?: [ 
      {
        chunkId?: string(name='chunkId', example='98327482364'),
        chunkMeta?: map[string]any(name='chunkMeta', example='{"a":"1"}'),
        chunkOssUrl?: string(name='chunkOssUrl', example='http://oss-xxx-hangzhou.com/xxx'),
        chunkText?: string(name='chunkText'),
        chunkType?: string(name='chunkType', example='text'),
        docId?: string(name='docId', example='92837482364'),
        fileType?: string(name='fileType', example='pdf'),
        libraryId?: string(name='libraryId', example='sjdhgjsd'),
        libraryName?: string(name='libraryName'),
        nextChunkId?: string(name='nextChunkId', example='2387648263542'),
        pos?: [ 
          {
            axisArray?: [ double ](name='axisArray'),
            page?: int32(name='page', example='1'),
            textHighlightArea?: [ int32 ](name='textHighlightArea'),
          }
        ](name='pos'),
        preChunkId?: string(name='preChunkId', example='32874682764'),
        score?: float(name='score', example='0.5'),
        title?: string(name='title'),
      }
    ](name='chunkPartList'),
    chunkTextList?: [ string ](name='chunkTextList'),
    documents?: [ 
      {
        docId?: string(name='docId', example='92837482364'),
        documentMeta?: map[string]any(name='documentMeta', example='{"a":"1"}'),
        fileType?: string(name='fileType', example='pdf'),
        gmtCreate?: string(name='gmtCreate', example='2024-01-01 00:00:00'),
        libraryId?: string(name='libraryId', example='sjdhgjsd'),
        title?: string(name='title', example='test'),
        url?: string(name='url', example='http://oss-xxx-hangzhou.com/test.pdf'),
      }
    ](name='documents'),
    embeddingElapsedMs?: long(name='embeddingElapsedMs', example='100'),
    textChunkList?: [ 
      {
        chunkId?: string(name='chunkId', example='32874682364'),
        chunkMeta?: map[string]any(name='chunkMeta', example='{"a":"1"}'),
        chunkOssUrl?: string(name='chunkOssUrl', example='http://oss-xxx-hangzhou.com/xxx'),
        chunkText?: string(name='chunkText'),
        chunkType?: string(name='chunkType', example='text'),
        docId?: string(name='docId', example='8372467263542'),
        fileType?: string(name='fileType', example='pdf'),
        libraryId?: string(name='libraryId', example='djsgfsjd'),
        libraryName?: string(name='libraryName'),
        nextChunkId?: string(name='nextChunkId', example='23874682432'),
        pos?: [ 
          {
            axisArray?: [ double ](name='axisArray'),
            page?: int32(name='page', example='1'),
            textHighlightArea?: [ int32 ](name='textHighlightArea'),
          }
        ](name='pos'),
        preChunkId?: string(name='preChunkId', example='89473868346'),
        score?: float(name='score', example='0.5'),
        title?: string(name='title'),
      }
    ](name='textChunkList'),
    textSearchElapsedMs?: long(name='textSearchElapsedMs', example='100'),
    totalElapsedMs?: long(name='totalElapsedMs', example='400'),
    vectorChunkList?: [ 
      {
        chunkId?: string(name='chunkId', example='8723642345276'),
        chunkMeta?: map[string]any(name='chunkMeta', example='{"a":"1"}'),
        chunkOssUrl?: string(name='chunkOssUrl', example='https://oss-xxxx-hangzhou.com/test.pdf'),
        chunkText?: string(name='chunkText'),
        chunkType?: string(name='chunkType', example='text'),
        docId?: string(name='docId', example='78326476235675372'),
        fileType?: string(name='fileType', example='pdf'),
        libraryId?: string(name='libraryId', example='djsgfsjd'),
        libraryName?: string(name='libraryName'),
        nextChunkId?: string(name='nextChunkId', example='293846872343'),
        pos?: [ 
          {
            axisArray?: [ double ](name='axisArray'),
            page?: int32(name='page', example='1'),
            textHighlightArea?: [ int32 ](name='textHighlightArea'),
          }
        ](name='pos'),
        preChunkId?: string(name='preChunkId', example='873647326542'),
        score?: float(name='score', example='0.5'),
        title?: string(name='title', example='test'),
      }
    ](name='vectorChunkList'),
    vectorSearchElapsedMs?: long(name='vectorSearchElapsedMs', example='100'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='0bc13a9517168617617186457e401f'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model RecallDocumentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RecallDocumentResponseBody(name='body'),
}

/**
 * @summary 文档召回。
 *
 * @param request RecallDocumentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RecallDocumentResponse
 */
async function recallDocumentWithOptions(workspaceId: string, request: RecallDocumentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RecallDocumentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.filters)) {
    body['filters'] = request.filters;
  }
  if (!Util.isUnset(request.query)) {
    body['query'] = request.query;
  }
  if (!Util.isUnset(request.rearrangement)) {
    body['rearrangement'] = request.rearrangement;
  }
  if (!Util.isUnset(request.topK)) {
    body['topK'] = request.topK;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RecallDocument',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/recallDocument`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 文档召回。
 *
 * @param request RecallDocumentRequest
 * @return RecallDocumentResponse
 */
async function recallDocument(workspaceId: string, request: RecallDocumentRequest): RecallDocumentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return recallDocumentWithOptions(workspaceId, request, headers, runtime);
}

model RecognizeIntentionRequest {
  analysis?: boolean(name='analysis', example='false'),
  bizType?: string(name='bizType', description='This parameter is required.', example='common'),
  conversation?: string(name='conversation', description='This parameter is required.'),
  globalIntentionList?: [ 
    {
      description?: string(name='description'),
      intention?: string(name='intention'),
      intentionCode?: string(name='intentionCode', example='1810566978021232640'),
      intentionScript?: string(name='intentionScript'),
    }
  ](name='globalIntentionList'),
  hierarchicalIntentionList?: [ 
    {
      description?: string(name='description'),
      intention?: string(name='intention'),
      intentionCode?: string(name='intentionCode', example='1810929291010150400'),
      intentionScript?: string(name='intentionScript'),
    }
  ](name='hierarchicalIntentionList'),
  intentionDomainCode?: string(name='intentionDomainCode'),
  intentionList?: [ 
    {
      description?: string(name='description'),
      intention?: string(name='intention'),
      intentionCode?: string(name='intentionCode', example='1808766224000262144'),
      intentionScript?: string(name='intentionScript'),
    }
  ](name='intentionList'),
  opType?: string(name='opType', example='common'),
  recommend?: boolean(name='recommend', example='false'),
}

model RecognizeIntentionResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    analysisProcess?: string(name='analysisProcess'),
    intentionCode?: string(name='intentionCode', example='1'),
    intentionName?: string(name='intentionName'),
    intentionScript?: string(name='intentionScript'),
    recommendIntention?: string(name='recommendIntention'),
    recommendScript?: string(name='recommendScript'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='003D019A-1BB3-53EC-A0D2-CE76DA5D73B1'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model RecognizeIntentionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RecognizeIntentionResponseBody(name='body'),
}

/**
 * @summary 意图识别
 *
 * @param request RecognizeIntentionRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RecognizeIntentionResponse
 */
async function recognizeIntentionWithOptions(workspaceId: string, request: RecognizeIntentionRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RecognizeIntentionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.analysis)) {
    body['analysis'] = request.analysis;
  }
  if (!Util.isUnset(request.bizType)) {
    body['bizType'] = request.bizType;
  }
  if (!Util.isUnset(request.conversation)) {
    body['conversation'] = request.conversation;
  }
  if (!Util.isUnset(request.globalIntentionList)) {
    body['globalIntentionList'] = request.globalIntentionList;
  }
  if (!Util.isUnset(request.hierarchicalIntentionList)) {
    body['hierarchicalIntentionList'] = request.hierarchicalIntentionList;
  }
  if (!Util.isUnset(request.intentionDomainCode)) {
    body['intentionDomainCode'] = request.intentionDomainCode;
  }
  if (!Util.isUnset(request.intentionList)) {
    body['intentionList'] = request.intentionList;
  }
  if (!Util.isUnset(request.opType)) {
    body['opType'] = request.opType;
  }
  if (!Util.isUnset(request.recommend)) {
    body['recommend'] = request.recommend;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RecognizeIntention',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/recog/intent`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 意图识别
 *
 * @param request RecognizeIntentionRequest
 * @return RecognizeIntentionResponse
 */
async function recognizeIntention(workspaceId: string, request: RecognizeIntentionRequest): RecognizeIntentionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return recognizeIntentionWithOptions(workspaceId, request, headers, runtime);
}

model RunAgentRequest {
  botId?: string(name='botId', description='This parameter is required.', example='d6zxykawk9'),
  modelId?: string(name='modelId', example='qwen-plus'),
  stream?: boolean(name='stream', example='true'),
  threadId?: string(name='threadId', example='4vlag5ken3'),
  useDraft?: boolean(name='useDraft', example='false'),
  userContent?: string(name='userContent', description='This parameter is required.'),
  versionId?: string(name='versionId', example='w4paqoezm2'),
}

model RunAgentResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    functionCallResponses?: [ 
      {
        displayName?: string(name='displayName'),
        endTime?: string(name='endTime', example='2025-01-21 16:37:14'),
        functionArgs?: string(name='functionArgs'),
        functionName?: string(name='functionName', example='web_search'),
        result?: string(name='result'),
        startTime?: string(name='startTime', example='2025-01-21 16:37:14'),
      }
    ](name='functionCallResponses'),
    inputTokens?: int32(name='inputTokens', example='766'),
    outputTokens?: int32(name='outputTokens', example='988'),
    response?: {
      choices?: [ 
        {
          finishReason?: string(name='finishReason', example='stop'),
          index?: int32(name='index', example='0'),
          message?: {
            content?: string(name='content'),
            role?: string(name='role', example='assistant'),
            roleDisplayName?: string(name='roleDisplayName', example='assistant'),
          }(name='message'),
        }
      ](name='choices'),
      created?: long(name='created', example='1737448637'),
      id?: string(name='id', example='d91d9afa-7cfc-4235-b012-a6f8e6ffa443'),
      modelId?: string(name='modelId', example='qwen-plus'),
      time?: string(name='time', example='2025-01-21T16:37:17.497206762'),
    }(name='response'),
    threadId?: string(name='threadId', example='4vlag5ken3'),
    traceId?: string(name='traceId', example='5bdb9809856c58acb92001f8ae65773c'),
    versionId?: string(name='versionId', example='w4paqoezm2'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='EF4B5C9B-3BC8-5171-A47B-4C5CF3DC3258'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-01-01 00:00:00'),
}

model RunAgentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RunAgentResponseBody(name='body'),
}

/**
 * @summary 运行智能体
 *
 * @param request RunAgentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RunAgentResponse
 */
async function runAgentWithOptions(workspaceId: string, request: RunAgentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RunAgentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.botId)) {
    body['botId'] = request.botId;
  }
  if (!Util.isUnset(request.modelId)) {
    body['modelId'] = request.modelId;
  }
  if (!Util.isUnset(request.stream)) {
    body['stream'] = request.stream;
  }
  if (!Util.isUnset(request.threadId)) {
    body['threadId'] = request.threadId;
  }
  if (!Util.isUnset(request.useDraft)) {
    body['useDraft'] = request.useDraft;
  }
  if (!Util.isUnset(request.userContent)) {
    body['userContent'] = request.userContent;
  }
  if (!Util.isUnset(request.versionId)) {
    body['versionId'] = request.versionId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RunAgent',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/bot/thread/run`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 运行智能体
 *
 * @param request RunAgentRequest
 * @return RunAgentResponse
 */
async function runAgent(workspaceId: string, request: RunAgentRequest): RunAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return runAgentWithOptions(workspaceId, request, headers, runtime);
}

model RunChatResultGenerationRequest {
  inferenceParameters?: map[string]any(name='inferenceParameters', example='{"topP": 0.8}'),
  messages?: [ 
    {
      content?: string(name='content'),
      role?: string(name='role', example='user'),
    }
  ](name='messages', description='This parameter is required.'),
  modelId?: string(name='modelId', description='This parameter is required.', example='qwen-max'),
  sessionId?: string(name='sessionId', example='237645726354'),
  stream?: boolean(name='stream', example='false'),
  tools?: [ 
    {
      function?: {
        description?: string(name='description'),
        name?: string(name='name', example='get_time'),
        parameters?: {
          properties?: map[string]any(name='properties', example='{
                            "location": {
                                "type": "string",
                                "description": "The city and state, e.g. San Francisco, CA"
                            },
                            "unit": {
                                "type": "string",
                                "enum": [
                                    "celsius",
                                    "fahrenheit"
                                ]
                            }
                        }'),
          type?: string(name='type', example='object'),
        }(name='parameters'),
        required?: [ string ](name='required'),
      }(name='function'),
      type?: string(name='type', example='function'),
    }
  ](name='tools'),
}

model RunChatResultGenerationResponseBody = {
  choices?: [ 
    {
      finishReason?: string(name='finishReason', example='null'),
      index?: int32(name='index', example='0'),
      message?: {
        content?: string(name='content'),
        role?: string(name='role', example='user'),
        toolCalls?: [  map[string]any ](name='toolCalls'),
      }(name='message'),
    }
  ](name='choices'),
  created?: long(name='created', example='1720602203'),
  id?: string(name='id', example='eb2b6139-ddf1-91a0-a47f-df7617ae9032'),
  modelId?: string(name='modelId', example='qwen-max'),
  requestId?: string(name='requestId', example='eb2b6139-ddf1-91a0-a47f-df7617ae9032'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
  totalTokens?: int32(name='totalTokens', example='500'),
  usage?: {
    imageCount?: int32(name='imageCount', example='0'),
    imageTokens?: int32(name='imageTokens', example='0'),
    inputTokens?: int32(name='inputTokens', example='200'),
    outputTokens?: int32(name='outputTokens', example='300'),
    totalTokens?: int32(name='totalTokens', example='500'),
  }(name='usage'),
}

model RunChatResultGenerationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RunChatResultGenerationResponseBody(name='body'),
}

/**
 * @summary 获取生成式对话结果
 *
 * @param request RunChatResultGenerationRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RunChatResultGenerationResponse
 */
async function runChatResultGenerationWithOptions(workspaceId: string, request: RunChatResultGenerationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RunChatResultGenerationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.inferenceParameters)) {
    body['inferenceParameters'] = request.inferenceParameters;
  }
  if (!Util.isUnset(request.messages)) {
    body['messages'] = request.messages;
  }
  if (!Util.isUnset(request.modelId)) {
    body['modelId'] = request.modelId;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['sessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.stream)) {
    body['stream'] = request.stream;
  }
  if (!Util.isUnset(request.tools)) {
    body['tools'] = request.tools;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RunChatResultGeneration',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/run/chat/generation`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取生成式对话结果
 *
 * @param request RunChatResultGenerationRequest
 * @return RunChatResultGenerationResponse
 */
async function runChatResultGeneration(workspaceId: string, request: RunChatResultGenerationRequest): RunChatResultGenerationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return runChatResultGenerationWithOptions(workspaceId, request, headers, runtime);
}

model RunLibraryChatGenerationRequest {
  docIdList?: [ string ](name='docIdList'),
  enableFollowUp?: boolean(name='enableFollowUp', example='false'),
  enableMultiQuery?: boolean(name='enableMultiQuery', example='false'),
  enableOpenQa?: boolean(name='enableOpenQa', example='false'),
  followUpLlm?: string(name='followUpLlm', example='qwen-max'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='3akzl28vap'),
  llmType?: string(name='llmType', description='This parameter is required.', example='qwen-max'),
  multiQueryLlm?: string(name='multiQueryLlm', example='qwen-max'),
  query?: string(name='query', description='This parameter is required.'),
  queryCriteria?: {
    and?: [ 
      {
        boost?: float(name='boost', example='0.5'),
        key?: string(name='key', example='city'),
        operator?: string(name='operator', example='eq'),
        value?: string(name='value'),
      }
    ](name='and'),
    or?: [ 
      {
        boost?: float(name='boost', example='0.5'),
        key?: string(name='key', example='city'),
        operator?: string(name='operator', example='eq'),
        value?: string(name='value'),
      }
    ](name='or'),
  }(name='queryCriteria'),
  rerankType?: string(name='rerankType', example='linear'),
  sessionId?: string(name='sessionId', description='sessionId', example='null'),
  stream?: boolean(name='stream', example='false'),
  subQueryList?: [ string ](name='subQueryList'),
  textSearchParameter?: {
    limit?: int32(name='limit', example='10'),
    searchAnalyzerType?: string(name='searchAnalyzerType', example='IkMaxWord'),
  }(name='textSearchParameter'),
  topK?: int32(name='topK', example='1'),
  vectorSearchParameter?: {
    limit?: int32(name='limit', example='10'),
  }(name='vectorSearchParameter'),
  withDocumentReference?: boolean(name='withDocumentReference', example='false'),
}

model RunLibraryChatGenerationResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: any(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='5E3FBAF1-17AF-53B7-AF0A-CDCEEB6DE658'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model RunLibraryChatGenerationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RunLibraryChatGenerationResponseBody(name='body'),
}

/**
 * @summary 获取生成式对话结果
 *
 * @param request RunLibraryChatGenerationRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RunLibraryChatGenerationResponse
 */
async function runLibraryChatGenerationWithOptions(workspaceId: string, request: RunLibraryChatGenerationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RunLibraryChatGenerationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.docIdList)) {
    body['docIdList'] = request.docIdList;
  }
  if (!Util.isUnset(request.enableFollowUp)) {
    body['enableFollowUp'] = request.enableFollowUp;
  }
  if (!Util.isUnset(request.enableMultiQuery)) {
    body['enableMultiQuery'] = request.enableMultiQuery;
  }
  if (!Util.isUnset(request.enableOpenQa)) {
    body['enableOpenQa'] = request.enableOpenQa;
  }
  if (!Util.isUnset(request.followUpLlm)) {
    body['followUpLlm'] = request.followUpLlm;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }
  if (!Util.isUnset(request.llmType)) {
    body['llmType'] = request.llmType;
  }
  if (!Util.isUnset(request.multiQueryLlm)) {
    body['multiQueryLlm'] = request.multiQueryLlm;
  }
  if (!Util.isUnset(request.query)) {
    body['query'] = request.query;
  }
  if (!Util.isUnset(request.queryCriteria)) {
    body['queryCriteria'] = request.queryCriteria;
  }
  if (!Util.isUnset(request.rerankType)) {
    body['rerankType'] = request.rerankType;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['sessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.stream)) {
    body['stream'] = request.stream;
  }
  if (!Util.isUnset(request.subQueryList)) {
    body['subQueryList'] = request.subQueryList;
  }
  if (!Util.isUnset(request.textSearchParameter)) {
    body['textSearchParameter'] = request.textSearchParameter;
  }
  if (!Util.isUnset(request.topK)) {
    body['topK'] = request.topK;
  }
  if (!Util.isUnset(request.vectorSearchParameter)) {
    body['vectorSearchParameter'] = request.vectorSearchParameter;
  }
  if (!Util.isUnset(request.withDocumentReference)) {
    body['withDocumentReference'] = request.withDocumentReference;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RunLibraryChatGeneration',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/run/library/chat/generation`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取生成式对话结果
 *
 * @param request RunLibraryChatGenerationRequest
 * @return RunLibraryChatGenerationResponse
 */
async function runLibraryChatGeneration(workspaceId: string, request: RunLibraryChatGenerationRequest): RunLibraryChatGenerationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return runLibraryChatGenerationWithOptions(workspaceId, request, headers, runtime);
}

model SubmitChatQuestionRequest {
  gmtService?: string(name='gmtService', description='This parameter is required.', example='2024-09-27 11:23:20'),
  liveScriptContent?: string(name='liveScriptContent', description='This parameter is required.'),
  openSmallTalk?: boolean(name='openSmallTalk', example='true'),
  questionList?: [ 
    {
      content?: string(name='content', description='This parameter is required.'),
      gmtCreate?: string(name='gmtCreate', description='This parameter is required.', example='2024-11-17 10:05:00'),
      reply?: string(name='reply'),
      sessionId?: string(name='sessionId', description='This parameter is required.', example='1869300950603128834'),
      type?: string(name='type', example='PRODUCT_QA'),
      userId?: string(name='userId', description='This parameter is required.', example='39485783475638465'),
      userName?: string(name='userName', description='This parameter is required.'),
    }
  ](name='questionList', description='This parameter is required.'),
  requestId?: string(name='requestId', description='This parameter is required.', example='0FC6636E-380A-5369-AE01-D1C15BB9B254'),
  sessionId?: string(name='sessionId', description='This parameter is required.', example='237645726354'),
}

model SubmitChatQuestionResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    batchId?: string(name='batchId', example='1869307330227937280'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='915AAAB9-4908-5224-9E53-9E9D7D0AA94B'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model SubmitChatQuestionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitChatQuestionResponseBody(name='body'),
}

/**
 * @summary 提交问题列表
 *
 * @param request SubmitChatQuestionRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitChatQuestionResponse
 */
async function submitChatQuestionWithOptions(workspaceId: string, request: SubmitChatQuestionRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SubmitChatQuestionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.gmtService)) {
    body['gmtService'] = request.gmtService;
  }
  if (!Util.isUnset(request.liveScriptContent)) {
    body['liveScriptContent'] = request.liveScriptContent;
  }
  if (!Util.isUnset(request.openSmallTalk)) {
    body['openSmallTalk'] = request.openSmallTalk;
  }
  if (!Util.isUnset(request.questionList)) {
    body['questionList'] = request.questionList;
  }
  if (!Util.isUnset(request.requestId)) {
    body['requestId'] = request.requestId;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['sessionId'] = request.sessionId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SubmitChatQuestion',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/virtualHuman/chat/submit`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 提交问题列表
 *
 * @param request SubmitChatQuestionRequest
 * @return SubmitChatQuestionResponse
 */
async function submitChatQuestion(workspaceId: string, request: SubmitChatQuestionRequest): SubmitChatQuestionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return submitChatQuestionWithOptions(workspaceId, request, headers, runtime);
}

model UpdateDocumentRequest {
  docId?: string(name='docId', description='This parameter is required.', example='123'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='abc123'),
  meta?: map[string]any(name='meta', example='{
        "businessId": "12321"
    }'),
  title?: string(name='title', example='test'),
}

model UpdateDocumentResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: string(name='data', example='null'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='eb2b6139-ddf1-91a0-a47f-df7617ae9032'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model UpdateDocumentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateDocumentResponseBody(name='body'),
}

/**
 * @summary 更新文档
 *
 * @param request UpdateDocumentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateDocumentResponse
 */
async function updateDocumentWithOptions(workspaceId: string, request: UpdateDocumentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateDocumentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.docId)) {
    body['docId'] = request.docId;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }
  if (!Util.isUnset(request.meta)) {
    body['meta'] = request.meta;
  }
  if (!Util.isUnset(request.title)) {
    body['title'] = request.title;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateDocument',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/document/updateDocument`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 更新文档
 *
 * @param request UpdateDocumentRequest
 * @return UpdateDocumentResponse
 */
async function updateDocument(workspaceId: string, request: UpdateDocumentRequest): UpdateDocumentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateDocumentWithOptions(workspaceId, request, headers, runtime);
}

model UpdateDocumentChunkRequest {
  chunks?: [ 
    {
      chunkId?: string(name='chunkId', description='This parameter is required.', example='1987834755763847'),
      chunkText?: string(name='chunkText', description='This parameter is required.'),
    }
  ](name='chunks', description='This parameter is required.'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='sjdgdsfg'),
}

model UpdateDocumentChunkResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: string(name='data', example='SUCCESS'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='003D019A-1BB3-53EC-A0D2-CE76DA5D73B1'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-01-01 00:00:00'),
}

model UpdateDocumentChunkResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateDocumentChunkResponseBody(name='body'),
}

/**
 * @summary 更新文档的chunk
 *
 * @param request UpdateDocumentChunkRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateDocumentChunkResponse
 */
async function updateDocumentChunkWithOptions(workspaceId: string, request: UpdateDocumentChunkRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateDocumentChunkResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.chunks)) {
    body['chunks'] = request.chunks;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateDocumentChunk',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/updateDocumentChunk`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 更新文档的chunk
 *
 * @param request UpdateDocumentChunkRequest
 * @return UpdateDocumentChunkResponse
 */
async function updateDocumentChunk(workspaceId: string, request: UpdateDocumentChunkRequest): UpdateDocumentChunkResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateDocumentChunkWithOptions(workspaceId, request, headers, runtime);
}

model UpdateLibraryRequest {
  description?: string(name='description'),
  indexSetting?: {
    chunkStrategy?: {
      docTreeSplit?: boolean(name='docTreeSplit', example='true'),
      docTreeSplitSize?: int32(name='docTreeSplitSize', example='160'),
      enhanceGraph?: boolean(name='enhanceGraph', example='true'),
      enhanceTable?: boolean(name='enhanceTable', example='true'),
      overlap?: int32(name='overlap', example='20'),
      sentenceSplit?: boolean(name='sentenceSplit', example='true'),
      sentenceSplitSize?: int32(name='sentenceSplitSize', example='160'),
      size?: int32(name='size', example='256'),
      split?: boolean(name='split', example='true'),
    }(name='chunkStrategy'),
    modelConfig?: {
      temperature?: double(name='temperature', example='0.8'),
      topP?: double(name='topP', description='topP', example='0.8'),
    }(name='modelConfig'),
    promptRoleStyle?: string(name='promptRoleStyle'),
    queryEnhancer?: {
      enableFollowUp?: boolean(name='enableFollowUp', example='true'),
      enableMultiQuery?: boolean(name='enableMultiQuery', example='true'),
      enableOpenQa?: boolean(name='enableOpenQa', example='true'),
      enableQueryRewrite?: boolean(name='enableQueryRewrite', example='true'),
      enableSession?: boolean(name='enableSession', example='true'),
      localKnowledgeId?: string(name='localKnowledgeId', example='sjdhgfc'),
      withDocumentReference?: boolean(name='withDocumentReference', example='true'),
    }(name='queryEnhancer'),
    recallStrategy?: {
      documentRankType?: string(name='documentRankType', example='model'),
      limit?: int32(name='limit', example='10'),
    }(name='recallStrategy'),
    textIndexSetting?: {
      category?: string(name='category', example='ElasticSearch'),
      enable?: boolean(name='enable', example='true'),
      indexAnalyzer?: string(name='indexAnalyzer', example='Standard'),
      rankThreshold?: double(name='rankThreshold', example='0.5'),
      searchAnalyzer?: string(name='searchAnalyzer', example='Standard'),
      topK?: int32(name='topK', example='50'),
    }(name='textIndexSetting'),
    vectorIndexSetting?: {
      category?: string(name='category', example='ADB'),
      embeddingType?: string(name='embeddingType', example='DashScope'),
      enable?: boolean(name='enable', example='true'),
      rankThreshold?: double(name='rankThreshold', example='0.5'),
      topK?: int32(name='topK', example='10'),
    }(name='vectorIndexSetting'),
  }(name='indexSetting'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='dsfbashdbb'),
  libraryName?: string(name='libraryName'),
}

model UpdateLibraryResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: string(name='data', example='null'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='eb2b6139-ddf1-91a0-a47f-df7617ae9032'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model UpdateLibraryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateLibraryResponseBody(name='body'),
}

/**
 * @summary 更新文档库配置
 *
 * @param request UpdateLibraryRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateLibraryResponse
 */
async function updateLibraryWithOptions(workspaceId: string, request: UpdateLibraryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateLibraryResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.indexSetting)) {
    body['indexSetting'] = request.indexSetting;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }
  if (!Util.isUnset(request.libraryName)) {
    body['libraryName'] = request.libraryName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateLibrary',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/update`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 更新文档库配置
 *
 * @param request UpdateLibraryRequest
 * @return UpdateLibraryResponse
 */
async function updateLibrary(workspaceId: string, request: UpdateLibraryRequest): UpdateLibraryResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateLibraryWithOptions(workspaceId, request, headers, runtime);
}

model UpdateQaLibraryRequest {
  parseQaResults?: [ 
    {
      answer?: string(name='answer', description='This parameter is required.'),
      question?: string(name='question', description='This parameter is required.'),
    }
  ](name='parseQaResults', description='This parameter is required.'),
  qaLibraryId?: string(name='qaLibraryId', example='6jh378d'),
  requestId?: string(name='requestId', description='This parameter is required.', example='0FC6636E-380A-5369-AE01-D1C15BB9B254'),
}

model UpdateQaLibraryResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: {
    qaLibraryId?: string(name='qaLibraryId', example='6jh378d'),
  }(name='data'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='EF4B5C9B-3BC8-5171-A47B-4C5CF3DC3258'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model UpdateQaLibraryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateQaLibraryResponseBody(name='body'),
}

/**
 * @summary 更新QA问答库
 *
 * @param request UpdateQaLibraryRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateQaLibraryResponse
 */
async function updateQaLibraryWithOptions(workspaceId: string, request: UpdateQaLibraryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateQaLibraryResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.parseQaResults)) {
    body['parseQaResults'] = request.parseQaResults;
  }
  if (!Util.isUnset(request.qaLibraryId)) {
    body['qaLibraryId'] = request.qaLibraryId;
  }
  if (!Util.isUnset(request.requestId)) {
    body['requestId'] = request.requestId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateQaLibrary',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/virtualHuman/qa/upload`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 更新QA问答库
 *
 * @param request UpdateQaLibraryRequest
 * @return UpdateQaLibraryResponse
 */
async function updateQaLibrary(workspaceId: string, request: UpdateQaLibraryRequest): UpdateQaLibraryResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateQaLibraryWithOptions(workspaceId, request, headers, runtime);
}

model UploadDocumentRequest {
  data?: string(name='data'),
  fileName?: string(name='fileName', description='This parameter is required.', example='test.pdf'),
  fileUrl?: string(name='fileUrl', description='This parameter is required.', example='https://oss-xxx.hangzhou.com/test.pdf'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='sjdhbcsj'),
}

model UploadDocumentAdvanceRequest {
  data?: string(name='data'),
  fileName?: string(name='fileName', description='This parameter is required.', example='test.pdf'),
  fileUrlObject?: readable(name='fileUrl', description='This parameter is required.', example='https://oss-xxx.hangzhou.com/test.pdf'),
  libraryId?: string(name='libraryId', description='This parameter is required.', example='sjdhbcsj'),
}

model UploadDocumentResponseBody = {
  cost?: long(name='cost', example='null'),
  data?: string(name='data', example='1782981430906818562'),
  dataType?: string(name='dataType', example='null'),
  errCode?: string(name='errCode', example='0'),
  message?: string(name='message', example='ok'),
  requestId?: string(name='requestId', example='ff3fef67-48d9-4379-a237-9ba8143fe739'),
  success?: boolean(name='success', example='true'),
  time?: string(name='time', example='2024-04-24 11:54:34'),
}

model UploadDocumentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UploadDocumentResponseBody(name='body'),
}

/**
 * @summary 上传文档到文档库
 *
 * @param request UploadDocumentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UploadDocumentResponse
 */
async function uploadDocumentWithOptions(workspaceId: string, request: UploadDocumentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UploadDocumentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.data)) {
    body['data'] = request.data;
  }
  if (!Util.isUnset(request.fileName)) {
    body['fileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileUrl)) {
    body['fileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.libraryId)) {
    body['libraryId'] = request.libraryId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UploadDocument',
    version = '2024-06-28',
    protocol = 'HTTPS',
    pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/api/library/document/upload`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 上传文档到文档库
 *
 * @param request UploadDocumentRequest
 * @return UploadDocumentResponse
 */
async function uploadDocument(workspaceId: string, request: UploadDocumentRequest): UploadDocumentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return uploadDocumentWithOptions(workspaceId, request, headers, runtime);
}

async function uploadDocumentAdvance(workspaceId: string, request: UploadDocumentAdvanceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UploadDocumentResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'DianJin',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var uploadDocumentReq = new UploadDocumentRequest{};
  OpenApiUtil.convert(request, uploadDocumentReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    uploadDocumentReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var uploadDocumentResp = uploadDocumentWithOptions(workspaceId, uploadDocumentReq, headers, runtime);
  return uploadDocumentResp;
}

